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 |
---|---|---|---|---|---|---|
1234 | Codeforces Round 590 (Div. 3) | FINISHED | False | 8100 | 161882699 | Oct. 1, 2019, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 2796 ) | E | Special Permutations | PROGRAMMING | math | 2000 |
B"Let's define p_i(n) as the following permutation: [i, 1, 2, ... , i - 1, i + 1, ... , n] . This means that the i -th permutation is almost identity (i.e. which maps every element to itself) permutation but the element i is on the first position. Examples: You are given an array x_1, x_2, ... , x_m ( 1 <= x_i <= n ). Let pos(p, val) be the position of the element val in p . So, pos(p_1(4), 3) = 3, pos(p_2(4), 2) = 1, pos(p_4(4), 4) = 1 . Let's define a function f(p) = sum limits_{i=1}^{m - 1} |pos(p, x_i) - pos(p, x_{i + 1})| , where |val| is the absolute value of val . This function means the sum of distances between adjacent elements of x in p . Your task is to calculate f(p_1(n)), f(p_2(n)), ... , f(p_n(n)) . The first line of the input contains two integers n and m ( 2 <= n, m <= 2 cdot 10^5 ) -- the number of elements in each permutation and the number of elements in x . The second line of the input contains m integers ( m , not n ) x_1, x_2, ... , x_m ( 1 <= x_i <= n ), where x_i is the i -th element of x . Elements of x can repeat and appear in arbitrary order. Print n integers: f(p_1(n)), f(p_2(n)), ... , f(p_n(n)) . Consider the first example: x = [1, 2, 3, 4] , so Consider the second example: x = [2, 1, 5, 3, 5] , so "... |
Codeforces Round #590 (Div. 3) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
61751636 | BeNoble | E | Oct. 3, 2019, 3:38 a.m. | OK | GNU C++11 | TESTS | 20 | 46 | 4608000 | 2000 | |
63525305 | Naive_Cat | E | Oct. 27, 2019, 5:04 a.m. | OK | GNU C++11 | TESTS | 20 | 62 | 37990400 | 2000 | |
61778215 | Naive_Cat | E | Oct. 3, 2019, 12:22 p.m. | OK | GNU C++11 | TESTS | 20 | 62 | 37990400 | 2000 | |
61826251 | ReaLNero1 | E | Oct. 4, 2019, 4:53 a.m. | OK | GNU C++11 | TESTS | 20 | 62 | 40038400 | 2000 | |
61778200 | Naive_Cat | E | Oct. 3, 2019, 12:22 p.m. | OK | GNU C++11 | TESTS | 20 | 62 | 40038400 | 2000 | |
62171416 | _violet | E | Oct. 9, 2019, 1:08 a.m. | OK | GNU C++11 | TESTS | 20 | 78 | 1638400 | 2000 | |
61950605 | AutumnKite | E | Oct. 6, 2019, 3:10 a.m. | OK | GNU C++11 | TESTS | 20 | 78 | 2252800 | 2000 | |
63232145 | Adelard | E | Oct. 23, 2019, 11:18 a.m. | OK | GNU C++11 | TESTS | 20 | 78 | 2457600 | 2000 | |
61695425 | chenyewei_1234 | E | Oct. 2, 2019, 6:51 a.m. | OK | GNU C++11 | TESTS | 20 | 78 | 2457600 | 2000 | |
62196594 | Llf0703 | E | Oct. 9, 2019, 11:03 a.m. | OK | GNU C++11 | TESTS | 20 | 78 | 3174400 | 2000 | |
62187185 | dlgumpupupday | E | Oct. 9, 2019, 8:37 a.m. | OK | GNU C++14 | TESTS | 20 | 62 | 4608000 | 2000 | |
62187067 | dlgumpupupday | E | Oct. 9, 2019, 8:35 a.m. | OK | GNU C++14 | TESTS | 20 | 62 | 4608000 | 2000 | |
61763993 | Amorphophallus | E | Oct. 3, 2019, 8:02 a.m. | OK | GNU C++14 | TESTS | 20 | 108 | 2457600 | 2000 | |
61892532 | fearlessgao | E | Oct. 5, 2019, 6:15 a.m. | OK | GNU C++14 | TESTS | 20 | 109 | 2355200 | 2000 | |
69227795 | Captain_Knuckles | E | Jan. 21, 2020, 8:06 a.m. | OK | GNU C++14 | TESTS | 20 | 109 | 2457600 | 2000 | |
63358648 | zycmx | E | Oct. 25, 2019, 4:17 a.m. | OK | GNU C++14 | TESTS | 20 | 109 | 2457600 | 2000 | |
62436624 | IPX-243 | E | Oct. 12, 2019, 5:43 p.m. | OK | GNU C++14 | TESTS | 20 | 109 | 2457600 | 2000 | |
62249475 | ssyze | E | Oct. 10, 2019, 8:47 a.m. | OK | GNU C++14 | TESTS | 20 | 109 | 2457600 | 2000 | |
61855905 | arman_ferdous | E | Oct. 4, 2019, 2:05 p.m. | OK | GNU C++14 | TESTS | 20 | 109 | 2457600 | 2000 | |
61949898 | jiuhuche | E | Oct. 6, 2019, 2:46 a.m. | OK | GNU C++14 | TESTS | 20 | 109 | 3174400 | 2000 | |
62061133 | Super_M. | E | Oct. 7, 2019, 1:41 p.m. | OK | GNU C++17 | TESTS | 20 | 77 | 40243200 | 2000 | |
62397970 | RealFreddy | E | Oct. 12, 2019, 6:17 a.m. | OK | GNU C++17 | TESTS | 20 | 78 | 40243200 | 2000 | |
68060552 | Uzumaki_Narutoo | E | Jan. 2, 2020, 3:25 a.m. | OK | GNU C++17 | TESTS | 20 | 108 | 5632000 | 2000 | |
62764492 | hellowbaby | E | Oct. 17, 2019, 8:08 a.m. | OK | GNU C++17 | TESTS | 20 | 108 | 8601600 | 2000 | |
69248448 | vjudge5 | E | Jan. 21, 2020, 1:35 p.m. | OK | GNU C++17 | TESTS | 20 | 109 | 2457600 | 2000 | |
64720844 | Hile_Meow | E | Nov. 12, 2019, 3:21 a.m. | OK | GNU C++17 | TESTS | 20 | 109 | 2457600 | 2000 | |
61948267 | aiktt | E | Oct. 6, 2019, 1:47 a.m. | OK | GNU C++17 | TESTS | 20 | 109 | 2457600 | 2000 | |
61712634 | Momentum | E | Oct. 2, 2019, 11:47 a.m. | OK | GNU C++17 | TESTS | 20 | 109 | 2457600 | 2000 | |
61695299 | DrGilbert | E | Oct. 2, 2019, 6:50 a.m. | OK | GNU C++17 | TESTS | 20 | 109 | 2457600 | 2000 | |
67994972 | mikuz | E | Dec. 31, 2019, 7:34 a.m. | OK | GNU C++17 | TESTS | 20 | 109 | 3993600 | 2000 | |
61855781 | maguroguma | E | Oct. 4, 2019, 2:02 p.m. | OK | Go | TESTS | 20 | 186 | 77107200 | 2000 | |
61894454 | maguroguma | E | Oct. 5, 2019, 6:50 a.m. | OK | Go | TESTS | 20 | 187 | 75878400 | 2000 | |
61895655 | maguroguma | E | Oct. 5, 2019, 7:10 a.m. | OK | Go | TESTS | 20 | 187 | 77107200 | 2000 | |
62888216 | stefan.sakalik | E | Oct. 18, 2019, 7:15 p.m. | OK | Go | TESTS | 20 | 202 | 7577600 | 2000 | |
61862592 | z20124528 | E | Oct. 4, 2019, 3:44 p.m. | OK | Go | TESTS | 20 | 935 | 14336000 | 2000 | |
61861028 | z20124528 | E | Oct. 4, 2019, 3:21 p.m. | OK | Go | TESTS | 20 | 982 | 14336000 | 2000 | |
61774225 | uwi | E | Oct. 3, 2019, 11:12 a.m. | OK | Java 8 | TESTS | 20 | 170 | 0 | 2000 | |
62071898 | amolpratap007 | E | Oct. 7, 2019, 5 p.m. | OK | Java 8 | TESTS | 20 | 171 | 0 | 2000 | |
62240918 | Ruins | E | Oct. 10, 2019, 1:37 a.m. | OK | Java 8 | TESTS | 20 | 186 | 3072000 | 2000 | |
61786771 | Katushechka | E | Oct. 3, 2019, 2:40 p.m. | OK | Java 8 | TESTS | 20 | 186 | 10547200 | 2000 | |
61908112 | Baroudy | E | Oct. 5, 2019, 10:12 a.m. | OK | Java 8 | TESTS | 20 | 187 | 0 | 2000 | |
61712616 | Anonymous | E | Oct. 2, 2019, 11:47 a.m. | OK | Java 8 | TESTS | 20 | 187 | 0 | 2000 | |
62887360 | IDzekh | E | Oct. 18, 2019, 6:54 p.m. | OK | Java 8 | TESTS | 20 | 202 | 2969600 | 2000 | |
61954024 | sonusingh.nitaa | E | Oct. 6, 2019, 5:08 a.m. | OK | Java 8 | TESTS | 20 | 202 | 3072000 | 2000 | |
61938292 | mennafadali | E | Oct. 5, 2019, 6:38 p.m. | OK | Java 8 | TESTS | 20 | 202 | 3072000 | 2000 | |
63068994 | A7mad2000as | E | Oct. 21, 2019, 11:48 a.m. | OK | Java 8 | TESTS | 20 | 202 | 3072000 | 2000 | |
64112487 | og.kostya | E | Nov. 2, 2019, 7:14 p.m. | OK | Mono C# | TESTS | 20 | 171 | 9318400 | 2000 | |
66621941 | hyzhangzhy | E | Dec. 11, 2019, 7:20 a.m. | OK | Mono C# | TESTS | 20 | 795 | 33382400 | 2000 | |
69807267 | vjudge1 | E | Jan. 30, 2020, 2:35 a.m. | OK | MS C++ | TESTS | 20 | 108 | 2457600 | 2000 | |
62087659 | vjudge1 | E | Oct. 8, 2019, 3:30 a.m. | OK | MS C++ | TESTS | 20 | 108 | 3993600 | 2000 | |
61742403 | tarattata1 | E | Oct. 2, 2019, 9 p.m. | OK | MS C++ | TESTS | 20 | 109 | 2457600 | 2000 | |
61736463 | shatty | E | Oct. 2, 2019, 6:24 p.m. | OK | MS C++ | TESTS | 20 | 249 | 2457600 | 2000 | |
64534764 | vjudge1 | E | Nov. 8, 2019, 4:36 p.m. | OK | MS C++ | TESTS | 20 | 296 | 3174400 | 2000 | |
69290062 | vjudge5 | E | Jan. 22, 2020, 9:52 a.m. | OK | MS C++ | TESTS | 20 | 374 | 30515200 | 2000 | |
64487982 | THTGAN | E | Nov. 7, 2019, 6:36 p.m. | OK | MS C++ 2017 | TESTS | 20 | 155 | 2457600 | 2000 | |
63422362 | university | E | Oct. 26, 2019, 6:49 a.m. | OK | MS C++ 2017 | TESTS | 20 | 156 | 2457600 | 2000 | |
61866786 | PapaGendu | E | Oct. 4, 2019, 4:49 p.m. | OK | MS C++ 2017 | TESTS | 20 | 233 | 13004800 | 2000 | |
61948452 | yoko2001_1 | E | Oct. 6, 2019, 1:53 a.m. | OK | MS C++ 2017 | TESTS | 20 | 280 | 2457600 | 2000 | |
61736450 | shatty | E | Oct. 2, 2019, 6:23 p.m. | OK | MS C++ 2017 | TESTS | 20 | 296 | 2457600 | 2000 | |
61736410 | shatty | E | Oct. 2, 2019, 6:23 p.m. | OK | MS C++ 2017 | TESTS | 20 | 296 | 2457600 | 2000 | |
62025424 | prateek3110 | E | Oct. 6, 2019, 7:57 p.m. | OK | MS C++ 2017 | TESTS | 20 | 296 | 3174400 | 2000 | |
61947364 | vjudge4 | E | Oct. 6, 2019, 1:05 a.m. | OK | MS C++ 2017 | TESTS | 20 | 296 | 3174400 | 2000 | |
63658671 | yuanyuan2048 | E | Oct. 28, 2019, 1:27 p.m. | OK | MS C++ 2017 | TESTS | 20 | 311 | 2662400 | 2000 | |
61860036 | GeKa | E | Oct. 4, 2019, 3:06 p.m. | OK | MS C++ 2017 | TESTS | 20 | 311 | 7270400 | 2000 | |
62023900 | zaceleiseliakai | E | Oct. 6, 2019, 6:56 p.m. | OK | PyPy 2 | TESTS | 20 | 1278 | 128921600 | 2000 | |
61875569 | Jarik | E | Oct. 4, 2019, 8 p.m. | OK | PyPy 3 | TESTS | 20 | 436 | 43008000 | 2000 | |
61842186 | Leendertz | E | Oct. 4, 2019, 10:04 a.m. | OK | PyPy 3 | TESTS | 20 | 482 | 42598400 | 2000 | |
69883592 | smart_hard | E | Jan. 31, 2020, 7:20 a.m. | OK | PyPy 3 | TESTS | 20 | 592 | 19865600 | 2000 | |
61737418 | shatty | E | Oct. 2, 2019, 6:45 p.m. | OK | PyPy 3 | TESTS | 20 | 607 | 22425600 | 2000 | |
69883613 | smart_hard | E | Jan. 31, 2020, 7:20 a.m. | OK | PyPy 3 | TESTS | 20 | 608 | 19763200 | 2000 | |
61737452 | shatty | E | Oct. 2, 2019, 6:45 p.m. | OK | PyPy 3 | TESTS | 20 | 639 | 22425600 | 2000 | |
61726554 | tjake | E | Oct. 2, 2019, 3:37 p.m. | OK | PyPy 3 | TESTS | 20 | 639 | 29491200 | 2000 | |
63039081 | limuyang01 | E | Oct. 20, 2019, 10:55 p.m. | OK | PyPy 3 | TESTS | 20 | 686 | 19353600 | 2000 | |
62462277 | _Kee | E | Oct. 13, 2019, 8:41 a.m. | OK | PyPy 3 | TESTS | 20 | 904 | 52019200 | 2000 | |
61783257 | SinKing | E | Oct. 3, 2019, 1:47 p.m. | OK | PyPy 3 | TESTS | 20 | 1122 | 16998400 | 2000 | |
62751920 | Code_Bear | E | Oct. 17, 2019, 2 a.m. | OK | Python 3 | TESTS | 20 | 1013 | 14745600 | 2000 | |
62119216 | bouncypi | E | Oct. 8, 2019, 2:12 p.m. | OK | Python 3 | TESTS | 20 | 1013 | 23142400 | 2000 | |
61737349 | shatty | E | Oct. 2, 2019, 6:43 p.m. | OK | Python 3 | TESTS | 20 | 1029 | 13312000 | 2000 | |
61735930 | abhishek.kr.met16 | E | Oct. 2, 2019, 6:12 p.m. | OK | Python 3 | TESTS | 20 | 1216 | 44032000 | 2000 | |
62035168 | BeNoble | E | Oct. 7, 2019, 3:23 a.m. | OK | Python 3 | TESTS | 20 | 1372 | 19251200 | 2000 | |
66973639 | sruthi_1729 | E | Dec. 15, 2019, 1:57 p.m. | OK | Python 3 | TESTS | 20 | 1388 | 20172800 | 2000 | |
62366941 | deep__679 | E | Oct. 11, 2019, 2:08 p.m. | OK | Python 3 | TESTS | 20 | 1404 | 19251200 | 2000 | |
62968264 | vishnutheerthep | E | Oct. 20, 2019, 5:49 a.m. | OK | Python 3 | TESTS | 20 | 1933 | 24064000 | 2000 | |
61743794 | titia | E | Oct. 2, 2019, 10:01 p.m. | OK | Python 3 | TESTS | 20 | 1981 | 24064000 | 2000 | |
61752908 | ikazuya0201 | E | Oct. 3, 2019, 4:17 a.m. | OK | Rust | TESTS | 20 | 78 | 5632000 | 2000 |
Back to search problems