Good Bye 2021: 2022 is NEAR

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1616 Good Bye 2021: 2022 is NEAR FINISHED False 7200 96474263 Dec. 29, 2021, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2530 ) E Lexicographically Small Enough PROGRAMMING data structures greedy strings 2200

B"You are given two strings s and t of equal length n . In one move, you can swap any two adjacent characters of the string s . You need to find the minimal number of operations you need to make string s lexicographically smaller than string t . A string a is lexicographically smaller than a string b if and only if one of the following holds: The first line of input contains one integer q ( 1 <= q <= 10 ,000 ): the number of test cases. The first line of each test case contains a single integer n ( 1 <= n <= 10^5 ). The second line of each test case contains the string s consisting of n lowercase English letters. The third line of each test case contains the string t consisting of n lowercase English letters. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print in a separate line the minimal number of operations you need to make string s lexicographically smaller than string t , or -1 , if it's impossible. "...

Tutorials

Good Bye 2021 -- Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
141165453 rainboy E Dec. 30, 2021, 1:33 p.m. OK GNU C11 TESTS 40 62 4608000 2200
141206822 BeTapDi E Dec. 31, 2021, 2:11 a.m. OK GNU C++14 TESTS 40 31 2048000 2200
141206882 XueYJ E Dec. 31, 2021, 2:12 a.m. OK GNU C++14 TESTS 40 31 2662400 2200
141143138 Qing_Yang E Dec. 30, 2021, 9:34 a.m. OK GNU C++14 TESTS 40 31 2764800 2200
141201301 SuperJ6 E Dec. 30, 2021, 10:12 p.m. OK GNU C++14 TESTS 40 31 2867200 2200
141146393 GennadyTran E Dec. 30, 2021, 10:13 a.m. OK GNU C++14 TESTS 40 31 2969600 2200
141141249 zqyyy E Dec. 30, 2021, 9:09 a.m. OK GNU C++14 TESTS 40 31 3584000 2200
141134839 meyi E Dec. 29, 2021, 6:50 p.m. OK GNU C++14 TESTS 40 31 4198400 2200
141150375 lzc2001 E Dec. 30, 2021, 10:56 a.m. OK GNU C++14 TESTS 40 46 2252800 2200
141206246 usernameson E Dec. 31, 2021, 1:46 a.m. OK GNU C++14 TESTS 40 46 2252800 2200
141144497 nguot E Dec. 30, 2021, 9:50 a.m. OK GNU C++14 TESTS 40 46 2355200 2200
141163738 Alchemist0 E Dec. 30, 2021, 1:16 p.m. OK GNU C++17 TESTS 40 31 1433600 2200
141156011 nhywieza E Dec. 30, 2021, 11:52 a.m. OK GNU C++17 TESTS 40 31 1433600 2200
141206208 izlyforever E Dec. 31, 2021, 1:44 a.m. OK GNU C++17 TESTS 40 31 1433600 2200
141160146 Spitfire_F_Mk_IX E Dec. 30, 2021, 12:35 p.m. OK GNU C++17 TESTS 40 31 1536000 2200
141136097 T500 E Dec. 29, 2021, 7:05 p.m. OK GNU C++17 TESTS 40 31 1843200 2200
141162095 Joysky E Dec. 30, 2021, 12:57 p.m. OK GNU C++17 TESTS 40 31 2048000 2200
141179626 jhorvat E Dec. 30, 2021, 4:13 p.m. OK GNU C++17 TESTS 40 31 2150400 2200
141162090 izlyforever E Dec. 30, 2021, 12:57 p.m. OK GNU C++17 TESTS 40 31 2150400 2200
141141540 ValenKof E Dec. 30, 2021, 9:13 a.m. OK GNU C++17 TESTS 40 31 2150400 2200
141205513 user202729_ E Dec. 31, 2021, 1:18 a.m. OK GNU C++17 TESTS 40 31 2150400 2200
141141597 ecnerwala E Dec. 30, 2021, 9:13 a.m. OK GNU C++17 (64) TESTS 40 31 1331200 2200
141205037 basic_string E Dec. 31, 2021, 12:56 a.m. OK GNU C++17 (64) TESTS 40 31 1536000 2200
141136093 iamnifer E Dec. 29, 2021, 7:05 p.m. OK GNU C++17 (64) TESTS 40 31 1536000 2200
141207628 gqf123 E Dec. 31, 2021, 2:38 a.m. OK GNU C++17 (64) TESTS 40 31 1536000 2200
141209249 Thallium54 E Dec. 31, 2021, 3:33 a.m. OK GNU C++17 (64) TESTS 40 31 1638400 2200
141167867 fakhoury E Dec. 30, 2021, 1:59 p.m. OK GNU C++17 (64) TESTS 40 31 2560000 2200
141142605 panyaoyu E Dec. 30, 2021, 9:27 a.m. OK GNU C++17 (64) TESTS 40 31 2560000 2200
141132667 Kude E Dec. 29, 2021, 6:28 p.m. OK GNU C++17 (64) TESTS 40 31 2560000 2200
141171715 dioji E Dec. 30, 2021, 2:38 p.m. OK GNU C++17 (64) TESTS 40 31 2560000 2200
141138703 737 E Dec. 30, 2021, 9:04 a.m. OK GNU C++17 (64) TESTS 40 31 2662400 2200
141198574 baddog E Dec. 30, 2021, 8:47 p.m. OK GNU C++20 (64) TESTS 40 31 1843200 2200
141177647 Krolo7 E Dec. 30, 2021, 3:49 p.m. OK GNU C++20 (64) TESTS 40 31 1843200 2200
141136634 NullXD E Dec. 30, 2021, 8:26 a.m. OK GNU C++20 (64) TESTS 40 31 1843200 2200
141130520 stevenwjy E Dec. 29, 2021, 6:11 p.m. OK GNU C++20 (64) TESTS 40 31 2150400 2200
141184544 ScarletS E Dec. 30, 2021, 5:13 p.m. OK GNU C++20 (64) TESTS 40 31 2457600 2200
141207176 noname___ E Dec. 31, 2021, 2:23 a.m. OK GNU C++20 (64) TESTS 40 31 2457600 2200
141171698 maghrabyJr_ E Dec. 30, 2021, 2:38 p.m. OK GNU C++20 (64) TESTS 40 31 2457600 2200
141174837 erray E Dec. 30, 2021, 3:14 p.m. OK GNU C++20 (64) TESTS 40 31 2560000 2200
141131900 .Mahdi. E Dec. 29, 2021, 6:21 p.m. OK GNU C++20 (64) TESTS 40 31 2560000 2200
141192082 cosenza E Dec. 30, 2021, 6:48 p.m. OK GNU C++20 (64) TESTS 40 31 2560000 2200
141174146 Ste E Dec. 30, 2021, 3:07 p.m. OK Java 11 TESTS 40 296 0 2200
141191954 Restricted E Dec. 30, 2021, 6:47 p.m. OK Java 11 TESTS 40 530 4505600 2200
141148337 alexey.enkov E Dec. 30, 2021, 10:35 a.m. OK Kotlin 1.5 TESTS 40 404 819200 2200
141136193 r57shell E Dec. 30, 2021, 8:14 a.m. OK MS C++ 2017 TESTS 40 62 4505600 2200
141147680 ielenik E Dec. 30, 2021, 10:27 a.m. OK MS C++ 2017 TESTS 40 951 10854400 2200
141164769 OLOGY E Dec. 30, 2021, 1:26 p.m. OK PyPy 2 TESTS 40 358 8192000 2200
141157547 DBabichev E Dec. 30, 2021, 12:09 p.m. OK PyPy 2 TESTS 40 389 9216000 2200
141135131 DBabichev E Dec. 29, 2021, 6:53 p.m. OK PyPy 2 TESTS 40 405 8908800 2200
141150194 DBabichev E Dec. 30, 2021, 10:54 a.m. OK PyPy 2 TESTS 40 421 8908800 2200
141135867 DBabichev E Dec. 29, 2021, 7:02 p.m. OK PyPy 2 TESTS 40 436 8908800 2200
141150104 DBabichev E Dec. 30, 2021, 10:53 a.m. OK PyPy 2 TESTS 40 452 8908800 2200
141194936 you1234 E Dec. 30, 2021, 7:34 p.m. OK PyPy 2 TESTS 40 514 16691200 2200
141152907 oadey89 E Dec. 30, 2021, 11:20 a.m. OK PyPy 2 TESTS 40 685 10444800 2200
141156695 Marshmello E Dec. 30, 2021, 11:59 a.m. OK PyPy 2 TESTS 40 686 9523200 2200
141186461 hxu10 E Dec. 30, 2021, 5:37 p.m. OK PyPy 3 TESTS 40 249 9420800 2200
141136911 r57shell E Dec. 30, 2021, 8:33 a.m. OK PyPy 3 TESTS 40 264 9625600 2200
141133600 codicon E Dec. 29, 2021, 6:37 p.m. OK PyPy 3 TESTS 40 280 11059200 2200
141129707 eepsilon E Dec. 29, 2021, 6:06 p.m. OK PyPy 3 TESTS 40 296 10752000 2200
141131277 codicon E Dec. 29, 2021, 6:17 p.m. OK PyPy 3 TESTS 40 296 10956800 2200
141130385 titia E Dec. 29, 2021, 6:10 p.m. OK PyPy 3 TESTS 40 326 11161600 2200
141130675 titia E Dec. 29, 2021, 6:12 p.m. OK PyPy 3 TESTS 40 342 10854400 2200
141133862 codicon E Dec. 29, 2021, 6:39 p.m. OK PyPy 3 TESTS 40 343 11161600 2200
141133807 codicon E Dec. 29, 2021, 6:39 p.m. OK PyPy 3 TESTS 40 343 11366400 2200
141133531 codicon E Dec. 29, 2021, 6:36 p.m. OK PyPy 3 TESTS 40 358 11776000 2200
141162328 nicku123 E Dec. 30, 2021, 1 p.m. OK PyPy 3-64 TESTS 40 327 13414400 2200
141131798 codicon E Dec. 29, 2021, 6:21 p.m. OK PyPy 3-64 TESTS 40 919 16486400 2200
141131080 codicon E Dec. 29, 2021, 6:15 p.m. OK PyPy 3-64 TESTS 40 951 18534400 2200
141130602 codicon E Dec. 29, 2021, 6:12 p.m. OK PyPy 3-64 TESTS 40 997 20787200 2200
141156140 apilat E Dec. 30, 2021, 11:53 a.m. OK Rust 2021 TESTS 40 623 66969600 2200
141193998 qwerty787788 E Dec. 30, 2021, 7:17 p.m. OK Rust 2021 TESTS 40 654 3481600 2200

remove filters

Back to search problems