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 |
---|---|---|---|---|---|---|
1700 | Codeforces Round 802 (Div. 2) | FINISHED | False | 7200 | 76193699 | June 19, 2022, 9:05 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 942 ) | F | Puzzle | PROGRAMMING | dp greedy | 2600 |
B"Pupils Alice and Ibragim are best friends. It's Ibragim's birthday soon, so Alice decided to gift him a new puzzle. The puzzle can be represented as a matrix with 2 rows and n columns, every element of which is either 0 or 1 . In one move you can swap two values in neighboring cells. More formally, let's number rows 1 to 2 from top to bottom, and columns 1 to n from left to right. Also, let's denote a cell in row x and column y as (x, y) . We consider cells (x_1, y_1) and (x_2, y_2) neighboring if |x_1 - x_2| + |y_1 - y_2| = 1 . Alice doesn't like the way in which the cells are currently arranged, so she came up with her own arrangement, with which she wants to gift the puzzle to Ibragim. Since you are her smartest friend, she asked you to help her find the minimal possible number of operations in which she can get the desired arrangement. Find this number, or determine that it's not possible to get the new arrangement. The first line contains an integer n ( 1 <= q n <= q 200 ,000 ) -- the number of columns in the puzzle. Following two lines describe the current arrangement on the puzzle. Each line contains n integers, every one of which is either 0 or 1 . The last two lines describe Alice's desired arrangement in the same format. If it is possible to get the desired arrangement, print the minimal possible number of steps, otherwise print -1 . In the first example the following sequence of swaps will suffice: It can be shown that 5 is the minimal possible answer in this case. In the second example no matter what swaps you do, you won't get the desired arrangement, so the answer is -1 . "... |
103978 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
161210276 | vccaiji | F | June 19, 2022, 10:48 a.m. | OK | GNU C++14 | TESTS | 69 | 171 | 35328000 | 2600 | |
161268692 | Jarin_Tasnim_Hridy | F | June 20, 2022, 3:44 a.m. | OK | GNU C++14 | TESTS | 71 | 546 | 3174400 | 2600 | |
161233718 | Jarin_Tasnim_Hridy | F | June 19, 2022, 2:21 p.m. | OK | GNU C++14 | TESTS | 69 | 561 | 3174400 | 2600 | |
161227934 | Bobocan | F | June 19, 2022, 1:09 p.m. | OK | GNU C++17 | TESTS | 69 | 31 | 3993600 | 2600 | |
161221499 | Whiteqwq | F | June 19, 2022, 11:58 a.m. | OK | GNU C++17 | TESTS | 69 | 109 | 1536000 | 2600 | |
161235405 | w-- | F | June 19, 2022, 2:44 p.m. | OK | GNU C++17 | TESTS | 69 | 156 | 3174400 | 2600 | |
161234569 | Kilani | F | June 19, 2022, 2:33 p.m. | OK | GNU C++17 | TESTS | 69 | 156 | 3174400 | 2600 | |
161260112 | TeaPot | F | June 19, 2022, 10:20 p.m. | OK | GNU C++17 | TESTS | 71 | 171 | 3174400 | 2600 | |
161214121 | Allen_3 | F | June 19, 2022, 11:01 a.m. | OK | GNU C++17 | TESTS | 69 | 171 | 3174400 | 2600 | |
161271347 | eE_v_Ee | F | June 20, 2022, 4:53 a.m. | OK | GNU C++17 | TESTS | 71 | 171 | 3481600 | 2600 | |
161239434 | Chromefish | F | June 19, 2022, 3:48 p.m. | OK | GNU C++17 | TESTS | 69 | 186 | 3174400 | 2600 | |
161227625 | Bobocan | F | June 19, 2022, 1:05 p.m. | OK | GNU C++17 | TESTS | 69 | 187 | 3174400 | 2600 | |
161218519 | bgg0516 | F | June 19, 2022, 11:34 a.m. | OK | GNU C++17 | TESTS | 69 | 187 | 3174400 | 2600 | |
161242551 | wenhao801 | F | June 19, 2022, 4:29 p.m. | OK | GNU C++17 (64) | TESTS | 70 | 62 | 3174400 | 2600 | |
161221326 | xay5421 | F | June 19, 2022, 11:56 a.m. | OK | GNU C++17 (64) | TESTS | 69 | 62 | 4812800 | 2600 | |
161218674 | Mr_Eight | F | June 19, 2022, 11:35 a.m. | OK | GNU C++17 (64) | TESTS | 69 | 78 | 7987200 | 2600 | |
161273908 | propane | F | June 20, 2022, 5:45 a.m. | OK | GNU C++17 (64) | TESTS | 71 | 93 | 3174400 | 2600 | |
161264002 | LYC_music | F | June 20, 2022, 1:34 a.m. | OK | GNU C++17 (64) | TESTS | 71 | 93 | 3174400 | 2600 | |
161218990 | froggyzhang | F | June 19, 2022, 11:37 a.m. | OK | GNU C++17 (64) | TESTS | 69 | 93 | 3174400 | 2600 | |
161260580 | kal013 | F | June 19, 2022, 10:44 p.m. | OK | GNU C++17 (64) | TESTS | 71 | 93 | 3993600 | 2600 | |
161219814 | TokieSan | F | June 19, 2022, 11:43 a.m. | OK | GNU C++17 (64) | TESTS | 69 | 93 | 3993600 | 2600 | |
161236541 | triple__a | F | June 19, 2022, 2:58 p.m. | OK | GNU C++17 (64) | TESTS | 69 | 93 | 8294400 | 2600 | |
161209098 | AngryLeaf | F | June 19, 2022, 10:44 a.m. | OK | GNU C++17 (64) | TESTS | 69 | 108 | 3993600 | 2600 | |
161262232 | Tyyyyyy | F | June 20, 2022, 12:19 a.m. | OK | GNU C++20 (64) | TESTS | 71 | 31 | 5324800 | 2600 | |
161262112 | ttklwxx | F | June 20, 2022, 12:13 a.m. | OK | GNU C++20 (64) | TESTS | 71 | 62 | 7987200 | 2600 | |
161270515 | akshaykhandelwal | F | June 20, 2022, 4:33 a.m. | OK | GNU C++20 (64) | TESTS | 71 | 78 | 4096000 | 2600 | |
161269192 | nvllable | F | June 20, 2022, 3:57 a.m. | OK | GNU C++20 (64) | TESTS | 71 | 78 | 4096000 | 2600 | |
161230602 | HollwoQ_Pelw | F | June 19, 2022, 1:40 p.m. | OK | GNU C++20 (64) | TESTS | 69 | 78 | 6451200 | 2600 | |
161209634 | blackbird137 | F | June 19, 2022, 10:45 a.m. | OK | GNU C++20 (64) | TESTS | 69 | 78 | 96153600 | 2600 | |
161220178 | IntoTheNight | F | June 19, 2022, 11:46 a.m. | OK | GNU C++20 (64) | TESTS | 69 | 93 | 2457600 | 2600 | |
161232706 | Proofy | F | June 19, 2022, 2:08 p.m. | OK | GNU C++20 (64) | TESTS | 69 | 93 | 3174400 | 2600 | |
161217270 | alvingogo | F | June 19, 2022, 11:25 a.m. | OK | GNU C++20 (64) | TESTS | 69 | 93 | 3276800 | 2600 | |
161211696 | jiangly | F | June 19, 2022, 10:53 a.m. | OK | GNU C++20 (64) | TESTS | 69 | 93 | 3276800 | 2600 | |
161268237 | dzhi | F | June 20, 2022, 3:32 a.m. | OK | Java 11 | TESTS | 71 | 249 | 204800 | 2600 | |
161268323 | dzhi | F | June 20, 2022, 3:34 a.m. | OK | Java 11 | TESTS | 71 | 264 | 204800 | 2600 | |
161268128 | dzhi | F | June 20, 2022, 3:30 a.m. | OK | Java 11 | TESTS | 71 | 264 | 204800 | 2600 | |
161268338 | dzhi | F | June 20, 2022, 3:35 a.m. | OK | Java 11 | TESTS | 71 | 265 | 204800 | 2600 | |
161268220 | dzhi | F | June 20, 2022, 3:31 a.m. | OK | Java 11 | TESTS | 71 | 280 | 204800 | 2600 | |
161269602 | taran_1407 | F | June 20, 2022, 4:08 a.m. | OK | Java 11 | TESTS | 71 | 280 | 1433600 | 2600 | |
161219869 | Vermeil | F | June 19, 2022, 11:44 a.m. | OK | PyPy 3-64 | TESTS | 69 | 374 | 41472000 | 2600 | |
161244339 | huikang | F | June 19, 2022, 4:55 p.m. | OK | PyPy 3-64 | TESTS | 70 | 530 | 56217600 | 2600 | |
161214061 | huikang | F | June 19, 2022, 11:01 a.m. | OK | PyPy 3-64 | TESTS | 69 | 592 | 56627200 | 2600 |
Back to search problems