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 |
---|---|---|---|---|---|---|
819 | Codeforces Round 421 (Div. 1) | FINISHED | False | 7200 | 233249099 | June 27, 2017, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1704 ) | B | Mister B and PR Shifts | PROGRAMMING | data structures implementation math | 2100 |
B"Some time ago Mister B detected a strange signal from the space, which he started to study. After some transformation the signal turned out to be a permutation p of length n or its cyclic shift. For the further investigation Mister B need some basis, that's why he decided to choose cyclic shift of this permutation which has the minimum possible deviation. Let's define the deviation of a permutation p as . Find a cyclic shift of permutation p with minimum possible deviation. If there are multiple solutions, print any of them. Let's denote id k (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89< xe2 x80 x89n) of a cyclic shift of permutation p as the number of right shifts needed to reach this shift, for example: First line contains single integer n (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89106) -- the length of the permutation. The second line contains n space-separated integers p1, xe2 x80 x89p2, xe2 x80 x89..., xe2 x80 x89pn (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89pi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n) -- the elements of the permutation. It is guaranteed that all elements are distinct. Print two integers: the minimum deviation of cyclic shifts of permutation p and the id of such shift. If there are multiple solutions, print any of them. In the first sample test the given permutation p is the identity permutation, that's why its deviation equals to 0, the shift id equals to 0 as well. In the second sample test the deviation of p equals to 4, the deviation of the 1-st cyclic shift (1, xe2 x80 x892, xe2 x80 x893) equals to 0, the deviation of the 2-nd cyclic shift (3, xe2 x80 x891, xe2 x80 x892) equals to 4, the optimal is the 1-st cyclic shift. In the third sample test the deviation of p equals to 4, the deviation of the 1-st cyclic shift (1, xe2 x80 x893, xe2 x80 x892) equals to 2, the deviation of the 2-nd cyclic shift (2, xe2 x80 x891, xe2 x80 x893) also equals to 2, so the optimal are both 1-st and 2-nd cyclic shifts. "... |
Codeforces Round #421 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
28165723 | sagiri_ | B | June 30, 2017, 6:53 a.m. | OK | FPC | TESTS | 80 | 280 | 17715200 | 2100 | |
28110633 | fsociety00 | B | June 28, 2017, 7:52 a.m. | OK | GNU C | TESTS | 80 | 280 | 18329600 | 2100 | |
28915985 | isgulkov | B | July 26, 2017, 11:12 p.m. | OK | GNU C | TESTS | 80 | 295 | 37990400 | 2100 | |
28916043 | isgulkov | B | July 26, 2017, 11:21 p.m. | OK | GNU C | TESTS | 80 | 311 | 37990400 | 2100 | |
28666422 | zhengyang | B | July 18, 2017, 11:32 a.m. | OK | GNU C++ | TESTS | 80 | 62 | 17920000 | 2100 | |
28194403 | huangzhen | B | July 1, 2017, 3:40 p.m. | OK | GNU C++ | TESTS | 80 | 62 | 17920000 | 2100 | |
29295899 | zhou888 | B | Aug. 9, 2017, 1:59 a.m. | OK | GNU C++ | TESTS | 80 | 62 | 18124800 | 2100 | |
28089834 | XuYipei | B | June 27, 2017, 3:35 p.m. | OK | GNU C++ | TESTS | 80 | 78 | 14131200 | 2100 | |
28083308 | hzq84621 | B | June 27, 2017, 2:58 p.m. | OK | GNU C++ | TESTS | 80 | 93 | 17920000 | 2100 | |
28090553 | jiyutian | B | June 27, 2017, 3:40 p.m. | OK | GNU C++ | TESTS | 80 | 93 | 26009600 | 2100 | |
31697997 | 1919810 | B | Oct. 25, 2017, 3:42 a.m. | OK | GNU C++ | TESTS | 80 | 93 | 72192000 | 2100 | |
28082411 | LoneFox | B | June 27, 2017, 2:54 p.m. | OK | GNU C++ | TESTS | 80 | 108 | 10137600 | 2100 | |
28092858 | _luckyE | B | June 27, 2017, 3:57 p.m. | OK | GNU C++ | TESTS | 80 | 124 | 86118400 | 2100 | |
32191878 | Yoyoball | B | Nov. 10, 2017, 10:59 a.m. | OK | GNU C++ | TESTS | 80 | 171 | 40243200 | 2100 | |
28138920 | greenarrow | B | June 29, 2017, 12:03 p.m. | OK | GNU C11 | TESTS | 80 | 187 | 13926400 | 2100 | |
28110619 | fsociety00 | B | June 28, 2017, 7:51 a.m. | OK | GNU C11 | TESTS | 80 | 265 | 18329600 | 2100 | |
31129733 | zhangzy | B | Oct. 7, 2017, 11:42 p.m. | OK | GNU C++11 | TESTS | 80 | 46 | 8294400 | 2100 | |
64191571 | luogu_bot1 | B | Nov. 4, 2019, 7:57 a.m. | OK | GNU C++11 | TESTS | 80 | 62 | 7987200 | 2100 | |
45322804 | wh030115 | B | Nov. 5, 2018, 11:28 a.m. | OK | GNU C++11 | TESTS | 80 | 62 | 16076800 | 2100 | |
45208621 | lizw0520zzh | B | Nov. 2, 2018, 2:02 p.m. | OK | GNU C++11 | TESTS | 80 | 62 | 16076800 | 2100 | |
45323104 | luogu_bot5 | B | Nov. 5, 2018, 11:36 a.m. | OK | GNU C++11 | TESTS | 80 | 62 | 32051200 | 2100 | |
28088248 | cbhcbh | B | June 27, 2017, 3:25 p.m. | OK | GNU C++11 | TESTS | 80 | 77 | 18124800 | 2100 | |
29296574 | sxy_cnyali | B | Aug. 9, 2017, 2:59 a.m. | OK | GNU C++11 | TESTS | 80 | 77 | 26112000 | 2100 | |
28088267 | lzr_010506 | B | June 27, 2017, 3:25 p.m. | OK | GNU C++11 | TESTS | 80 | 78 | 22118400 | 2100 | |
28085238 | ysy_win_ioi | B | June 27, 2017, 3:08 p.m. | OK | GNU C++11 | TESTS | 80 | 78 | 30208000 | 2100 | |
64225623 | Llf0703 | B | Nov. 4, 2019, 1:47 p.m. | OK | GNU C++11 | TESTS | 80 | 93 | 7987200 | 2100 | |
40980668 | ReaLNero1 | B | July 30, 2018, 5:38 p.m. | OK | GNU C++14 | TESTS | 80 | 46 | 10137600 | 2100 | |
28133957 | Gintoki | B | June 29, 2017, 7:31 a.m. | OK | GNU C++14 | TESTS | 80 | 46 | 12083200 | 2100 | |
28093351 | balakrishnan | B | June 27, 2017, 4:01 p.m. | OK | GNU C++14 | TESTS | 80 | 62 | 18841600 | 2100 | |
28095067 | platypus179 | B | June 27, 2017, 4:14 p.m. | OK | GNU C++14 | TESTS | 80 | 77 | 33996800 | 2100 | |
28084945 | Andrei1998 | B | June 27, 2017, 3:07 p.m. | OK | GNU C++14 | TESTS | 80 | 93 | 22118400 | 2100 | |
28089958 | LiChenKoh | B | June 27, 2017, 3:36 p.m. | OK | GNU C++14 | TESTS | 80 | 109 | 18022400 | 2100 | |
29498354 | leoly | B | Aug. 16, 2017, 6:54 a.m. | OK | GNU C++14 | TESTS | 80 | 140 | 178278400 | 2100 | |
28404305 | 1982589849 | B | July 10, 2017, 9:54 a.m. | OK | GNU C++14 | TESTS | 80 | 202 | 13926400 | 2100 | |
28089162 | natsugiri | B | June 27, 2017, 3:31 p.m. | OK | GNU C++14 | TESTS | 80 | 202 | 22016000 | 2100 | |
45793582 | RNS_KSB | B | Nov. 16, 2018, 8:57 a.m. | OK | GNU C++14 | TESTS | 80 | 234 | 11980800 | 2100 | |
61552421 | vjudge4 | B | Sept. 30, 2019, 12:55 p.m. | OK | GNU C++17 | TESTS | 80 | 264 | 12083200 | 2100 | |
45148369 | shahidul_brur | B | Oct. 31, 2018, 6:11 p.m. | OK | GNU C++17 | TESTS | 80 | 296 | 8294400 | 2100 | |
58225775 | KasugaAyumu | B | Aug. 3, 2019, 2:24 p.m. | OK | GNU C++17 | TESTS | 80 | 296 | 11980800 | 2100 | |
66273632 | QingLongShanXiaMouRuoZha | B | Dec. 4, 2019, 1:19 p.m. | OK | GNU C++17 | TESTS | 80 | 311 | 7987200 | 2100 | |
58518633 | Mai-sanBestWaifu | B | Aug. 10, 2019, 2:37 a.m. | OK | GNU C++17 | TESTS | 80 | 311 | 28057600 | 2100 | |
57351801 | Yadu | B | July 20, 2019, 4:08 a.m. | OK | GNU C++17 | TESTS | 80 | 312 | 32051200 | 2100 | |
35564924 | falric | B | Feb. 22, 2018, 5:02 a.m. | OK | GNU C++17 | TESTS | 80 | 327 | 26112000 | 2100 | |
54249806 | Juve45 | B | May 16, 2019, 4:38 p.m. | OK | GNU C++17 | TESTS | 80 | 327 | 40038400 | 2100 | |
42483112 | marcosmicJack | B | Sept. 5, 2018, 7:11 a.m. | OK | GNU C++17 | TESTS | 80 | 342 | 7987200 | 2100 | |
63070659 | luogu_bot2 | B | Oct. 21, 2019, 12:18 p.m. | OK | GNU C++17 | TESTS | 80 | 374 | 32051200 | 2100 | |
28166307 | S.Jindal | B | June 30, 2017, 7:28 a.m. | OK | Java 8 | TESTS | 80 | 233 | 28672000 | 2100 | |
28102645 | Dukkha | B | June 27, 2017, 7:21 p.m. | OK | Java 8 | TESTS | 80 | 342 | 56217600 | 2100 | |
28086950 | mmaxio | B | June 27, 2017, 3:17 p.m. | OK | Java 8 | TESTS | 80 | 343 | 60108800 | 2100 | |
28122600 | ebaalhuis | B | June 28, 2017, 2:51 p.m. | OK | Java 8 | TESTS | 80 | 358 | 60620800 | 2100 | |
28090705 | Slamur | B | June 27, 2017, 3:41 p.m. | OK | Java 8 | TESTS | 80 | 389 | 60518400 | 2100 | |
28087540 | AndreiNet | B | June 27, 2017, 3:21 p.m. | OK | Java 8 | TESTS | 80 | 420 | 38297600 | 2100 | |
34058624 | vovacomua | B | Jan. 9, 2018, 9:40 p.m. | OK | Java 8 | TESTS | 80 | 452 | 95027200 | 2100 | |
28289266 | kubusgol | B | July 4, 2017, 8:41 p.m. | OK | Java 8 | TESTS | 80 | 467 | 64921600 | 2100 | |
28172402 | bhishma | B | June 30, 2017, 1:03 p.m. | OK | Java 8 | TESTS | 80 | 498 | 65126400 | 2100 | |
28093086 | alexyz | B | June 27, 2017, 3:59 p.m. | OK | Java 8 | TESTS | 80 | 608 | 78848000 | 2100 | |
28089551 | riantkb | B | June 27, 2017, 3:33 p.m. | OK | Mono C# | TESTS | 80 | 748 | 135782400 | 2100 | |
28387972 | J_X | B | July 9, 2017, 1:13 p.m. | OK | PyPy 2 | TESTS | 80 | 514 | 82124800 | 2100 | |
28103714 | BenL | B | June 27, 2017, 8:42 p.m. | OK | PyPy 2 | TESTS | 80 | 530 | 65740800 | 2100 | |
28103666 | BenL | B | June 27, 2017, 8:37 p.m. | OK | PyPy 2 | TESTS | 80 | 545 | 65740800 | 2100 | |
28088161 | Cypi | B | June 27, 2017, 3:24 p.m. | OK | PyPy 2 | TESTS | 80 | 966 | 90726400 | 2100 | |
54781010 | pajenegod | B | May 28, 2019, 9:48 p.m. | OK | PyPy 2 | TESTS | 80 | 1013 | 68505600 | 2100 | |
40486552 | yugle7 | B | July 17, 2018, 5:03 p.m. | OK | PyPy 3 | TESTS | 80 | 1029 | 77721600 | 2100 | |
28103702 | BenL | B | June 27, 2017, 8:41 p.m. | OK | PyPy 3 | TESTS | 80 | 1918 | 93286400 | 2100 |
Back to search problems