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 |
---|---|---|---|---|---|---|
1682 | Codeforces Round 793 (Div. 2) | FINISHED | False | 7200 | 78593099 | May 22, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 626 ) | E | Unordered Swaps | PROGRAMMING | constructive algorithms dfs and similar graphs greedy math sortings |
B"Alice had a permutation p of numbers from 1 to n . Alice can swap a pair (x, y) which means swapping elements at positions x and y in p (i.e. swap p_x and p_y ). Alice recently learned her first sorting algorithm, so she decided to sort her permutation in the minimum number of swaps possible. She wrote down all the swaps in the order in which she performed them to sort the permutation on a piece of paper. For example, Unfortunately, Bob shuffled the sequence of swaps written by Alice. You are given Alice's permutation p and the swaps performed by Alice in arbitrary order. Can you restore the correct sequence of swaps that sorts the permutation p ? Since Alice wrote correct swaps before Bob shuffled them up, it is guaranteed that there exists some order of swaps that sorts the permutation. The first line contains 2 integers n and m (2 <= n <= 2 cdot 10^5, 1 <= m <= n - 1) -- the size of permutation and the minimum number of swaps required to sort the permutation. The next line contains n integers p_1, p_2, ..., p_n ( 1 <= p_i <= n , all p_i are distinct) -- the elements of p . It is guaranteed that p forms a permutation. Then m lines follow. The i -th of the next m lines contains two integers x_i and y_i -- the i -th swap (x_i, y_i) . It is guaranteed that it is possible to sort p with these m swaps and that there is no way to sort p with less than m swaps. Print a permutation of m integers -- a valid order of swaps written by Alice that sorts the permutation p . See sample explanation for better understanding. In case of multiple possible answers, output any. In the first example, p = [2, 3, 4, 1] , m = 3 and given swaps are [(1, 4), (2, 1), (1, 3)] . There is only one correct order of swaps i.e [2, 3, 1] . In the second exam"... |
Codeforces Round #793 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
158105035 | chro4896 | E | May 23, 2022, 2:38 a.m. | OK | GNU C11 | TESTS | 95 | 966 | 25600000 | ||
158369584 | vjudge3 | E | May 25, 2022, 9:01 a.m. | OK | GNU C++14 | TESTS | 95 | 249 | 18124800 | ||
158273594 | ZhangCW_QwQ | E | May 24, 2022, 7:20 a.m. | OK | GNU C++14 | TESTS | 95 | 249 | 45158400 | ||
158274169 | blade_dance | E | May 24, 2022, 7:29 a.m. | OK | GNU C++14 | TESTS | 95 | 264 | 35430400 | ||
158144368 | Daas | E | May 23, 2022, 12:43 p.m. | OK | GNU C++14 | TESTS | 95 | 280 | 20480000 | ||
158408690 | walk_alone | E | May 25, 2022, 4:32 p.m. | OK | GNU C++14 | TESTS | 95 | 295 | 20992000 | ||
158274080 | blade_dance | E | May 24, 2022, 7:27 a.m. | OK | GNU C++14 | TESTS | 95 | 295 | 35430400 | ||
158125227 | Intercept | E | May 23, 2022, 8:19 a.m. | OK | GNU C++14 | TESTS | 95 | 295 | 57446400 | ||
158286383 | Tyyyyyy | E | May 24, 2022, 10:16 a.m. | OK | GNU C++14 | TESTS | 95 | 311 | 18124800 | ||
158250758 | leukocyte | E | May 23, 2022, 11:40 p.m. | OK | GNU C++14 | TESTS | 95 | 311 | 24166400 | ||
158512999 | Bliss_of_comprehension | E | May 26, 2022, 9:56 a.m. | OK | GNU C++14 | TESTS | 95 | 312 | 23654400 | ||
158280760 | xxxxx250 | E | May 24, 2022, 8:59 a.m. | OK | GNU C++17 | TESTS | 95 | 249 | 16588800 | ||
158280666 | xxxxx250 | E | May 24, 2022, 8:58 a.m. | OK | GNU C++17 | TESTS | 95 | 265 | 19660800 | ||
158150502 | anodiebird | E | May 23, 2022, 1:58 p.m. | OK | GNU C++17 | TESTS | 95 | 295 | 25088000 | ||
158150895 | induk_v_tsiane | E | May 23, 2022, 2:03 p.m. | OK | GNU C++17 | TESTS | 95 | 295 | 25088000 | ||
158277042 | xxxxx250 | E | May 24, 2022, 8:09 a.m. | OK | GNU C++17 | TESTS | 95 | 296 | 16588800 | ||
158285331 | ahshafi | E | May 24, 2022, 10:01 a.m. | OK | GNU C++17 | TESTS | 95 | 296 | 26112000 | ||
158316888 | FlowRays | E | May 24, 2022, 4:09 p.m. | OK | GNU C++17 | TESTS | 95 | 311 | 20889600 | ||
158295205 | zhangmj2008 | E | May 24, 2022, 12:06 p.m. | OK | GNU C++17 | TESTS | 95 | 312 | 33280000 | ||
158322841 | vasvisood | E | May 24, 2022, 5:17 p.m. | OK | GNU C++17 | TESTS | 95 | 326 | 26726400 | ||
158282282 | yagoo | E | May 24, 2022, 9:17 a.m. | OK | GNU C++17 | TESTS | 95 | 326 | 26726400 | ||
158482600 | vjudge1 | E | May 26, 2022, 2:19 a.m. | OK | GNU C++17 (64) | TESTS | 95 | 218 | 24473600 | ||
158537916 | YYYLLL2021 | E | May 26, 2022, 2:34 p.m. | OK | GNU C++17 (64) | TESTS | 95 | 233 | 31948800 | ||
158250142 | enslaved | E | May 23, 2022, 11:14 p.m. | OK | GNU C++17 (64) | TESTS | 95 | 248 | 27443200 | ||
158482553 | xiece666 | E | May 26, 2022, 2:17 a.m. | OK | GNU C++17 (64) | TESTS | 95 | 249 | 24473600 | ||
158248989 | BERNARB.01 | E | May 23, 2022, 10:28 p.m. | OK | GNU C++17 (64) | TESTS | 95 | 264 | 43622400 | ||
158292538 | jockbutt | E | May 24, 2022, 11:34 a.m. | OK | GNU C++17 (64) | TESTS | 95 | 265 | 47104000 | ||
158150967 | AutumnKite | E | May 23, 2022, 2:04 p.m. | OK | GNU C++17 (64) | TESTS | 95 | 280 | 23961600 | ||
158103962 | froggyzhang | E | May 23, 2022, 2:09 a.m. | OK | GNU C++17 (64) | TESTS | 95 | 280 | 34816000 | ||
158107662 | exzang | E | May 23, 2022, 3:36 a.m. | OK | GNU C++17 (64) | TESTS | 95 | 280 | 37888000 | ||
158346885 | xiaolaogou | E | May 25, 2022, 3:29 a.m. | OK | GNU C++17 (64) | TESTS | 95 | 311 | 34406400 | ||
158273743 | fishcathu. | E | May 24, 2022, 7:22 a.m. | OK | GNU C++20 (64) | TESTS | 95 | 171 | 36864000 | ||
158274139 | fishcathu. | E | May 24, 2022, 7:28 a.m. | OK | GNU C++20 (64) | TESTS | 95 | 186 | 36864000 | ||
158273760 | fishcathu. | E | May 24, 2022, 7:23 a.m. | OK | GNU C++20 (64) | TESTS | 95 | 187 | 36864000 | ||
158256029 | -is-this-fft- | E | May 24, 2022, 2:21 a.m. | OK | GNU C++20 (64) | TESTS | 95 | 233 | 15257600 | ||
158505023 | fvogel | E | May 26, 2022, 8:12 a.m. | OK | GNU C++20 (64) | TESTS | 95 | 233 | 24678400 | ||
158114321 | Nea1 | E | May 23, 2022, 5:36 a.m. | OK | GNU C++20 (64) | TESTS | 95 | 249 | 23449600 | ||
158270110 | N_oB_ody | E | May 24, 2022, 6:28 a.m. | OK | GNU C++20 (64) | TESTS | 95 | 249 | 23961600 | ||
158268781 | N_oB_ody | E | May 24, 2022, 6:09 a.m. | OK | GNU C++20 (64) | TESTS | 95 | 249 | 25497600 | ||
158103487 | Tiagodfs | E | May 23, 2022, 1:55 a.m. | OK | GNU C++20 (64) | TESTS | 95 | 249 | 36352000 | ||
158332787 | Ooops_no | E | May 24, 2022, 7:37 p.m. | OK | GNU C++20 (64) | TESTS | 95 | 249 | 39116800 | ||
158151804 | zouyu9631 | E | May 23, 2022, 2:14 p.m. | OK | PyPy 3 | TESTS | 95 | 1450 | 69836800 | ||
158152226 | zouyu9631 | E | May 23, 2022, 2:19 p.m. | OK | PyPy 3-64 | TESTS | 95 | 1341 | 111206400 | ||
158105077 | asdsasd | E | May 23, 2022, 2:39 a.m. | OK | PyPy 3-64 | TESTS | 95 | 1996 | 139673600 | ||
158104928 | asdsasd | E | May 23, 2022, 2:36 a.m. | OK | PyPy 3-64 | TESTS | 95 | 1996 | 142848000 | ||
158152194 | zouyu9631 | E | May 23, 2022, 2:19 p.m. | OK | Python 3 | TESTS | 95 | 1887 | 75366400 | ||
158151895 | zouyu9631 | E | May 23, 2022, 2:15 p.m. | OK | Python 3 | TESTS | 95 | 1918 | 75571200 |
Back to search problems