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 |
---|---|---|---|---|---|---|
1450 | Codeforces Global Round 12 | FINISHED | False | 10800 | 124557899 | Dec. 6, 2020, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1352 ) | F | The Struggling Contestant | PROGRAMMING | constructive algorithms greedy |
B'To help those contestants who struggle a lot in contests, the headquarters of Codeforces are planning to introduce Division 5. In this new division, the tags of all problems will be announced prior to the round to help the contestants. The contest consists of n problems, where the tag of the i -th problem is denoted by an integer a_i . You want to AK (solve all problems). To do that, you must solve the problems in some order. To make the contest funnier, you created extra limitations on yourself. You do not want to solve two problems consecutively with the same tag since it is boring. Also, you are afraid of big jumps in difficulties while solving them, so you want to minimize the number of times that you solve two problems consecutively that are not adjacent in the contest order. Formally, your solve order can be described by a permutation p of length n . The cost of a permutation is defined as the number of indices i ( 1 <= i<n ) where |p_{i+1}-p_i|>1 . You have the requirement that a_{p_i} ne a_{p_{i+1}} for all 1 <= i< n . You want to know the minimum possible cost of permutation that satisfies the requirement. If no permutations meet this requirement, you should report about it. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The first line of the description of each test case contains a single integer n ( 1 <= n <= 10^5 ) -- the number of problems in the contest. The next line contains n integers a_1,a_2, ldots a_n ( 1 <= a_i <= n ) -- the tags of the problems. It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, if there are no permutations that satisfy the required condition, print -1 . Otherwise, print the minimum possible cost of a permutation that satisfies the required condition. In the first test case, let p=[5, 4, 3, 2, 1, 6] . The cost is'... |
Codeforces Global Round 12 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
100596291 | sunzihao | F | Dec. 7, 2020, 2:55 a.m. | OK | GNU C++11 | TESTS | 61 | 31 | 819200 | ||
100597978 | Fuyuki | F | Dec. 7, 2020, 3:53 a.m. | OK | GNU C++11 | TESTS | 61 | 31 | 3686400 | ||
100569372 | 201831990439 | F | Dec. 6, 2020, 4:33 p.m. | OK | GNU C++11 | TESTS | 61 | 31 | 20582400 | ||
100565297 | shenxy13 | F | Dec. 6, 2020, 4:14 p.m. | OK | GNU C++11 | TESTS | 61 | 46 | 614400 | ||
100597638 | RainAir | F | Dec. 7, 2020, 3:42 a.m. | OK | GNU C++11 | TESTS | 61 | 46 | 819200 | ||
100588160 | huangxiaohua | F | Dec. 6, 2020, 8:16 p.m. | OK | GNU C++11 | TESTS | 61 | 46 | 819200 | ||
100572103 | JeffreyLC | F | Dec. 6, 2020, 4:48 p.m. | OK | GNU C++11 | TESTS | 61 | 46 | 1024000 | ||
100594304 | 2016wudi | F | Dec. 7, 2020, 1:24 a.m. | OK | GNU C++11 | TESTS | 61 | 46 | 1024000 | ||
100589785 | srijon51 | F | Dec. 6, 2020, 9:08 p.m. | OK | GNU C++11 | TESTS | 61 | 46 | 1228800 | ||
100584156 | alex_Harry | F | Dec. 6, 2020, 6:47 p.m. | OK | GNU C++11 | TESTS | 61 | 46 | 1228800 | ||
100568861 | smallling | F | Dec. 6, 2020, 4:31 p.m. | OK | GNU C++14 | TESTS | 61 | 46 | 819200 | ||
100573314 | hamlet | F | Dec. 6, 2020, 4:55 p.m. | OK | GNU C++14 | TESTS | 61 | 46 | 1228800 | ||
100575616 | mat_v | F | Dec. 6, 2020, 5:08 p.m. | OK | GNU C++14 | TESTS | 61 | 46 | 1331200 | ||
100573028 | ub33 | F | Dec. 6, 2020, 4:53 p.m. | OK | GNU C++14 | TESTS | 61 | 46 | 1638400 | ||
100579797 | platter | F | Dec. 6, 2020, 5:30 p.m. | OK | GNU C++14 | TESTS | 61 | 46 | 1638400 | ||
100577909 | Xtale_cross | F | Dec. 6, 2020, 5:21 p.m. | OK | GNU C++14 | TESTS | 61 | 46 | 1740800 | ||
100579593 | SidneyMars | F | Dec. 6, 2020, 5:29 p.m. | OK | GNU C++14 | TESTS | 61 | 46 | 2252800 | ||
100577226 | Right_utkarsh | F | Dec. 6, 2020, 5:16 p.m. | OK | GNU C++14 | TESTS | 61 | 46 | 2662400 | ||
100575443 | Motarack | F | Dec. 6, 2020, 5:07 p.m. | OK | GNU C++14 | TESTS | 61 | 61 | 819200 | ||
100569376 | AlanChen | F | Dec. 6, 2020, 4:33 p.m. | OK | GNU C++14 | TESTS | 61 | 61 | 1126400 | ||
100574401 | Everule | F | Dec. 6, 2020, 5:01 p.m. | OK | GNU C++17 | TESTS | 61 | 46 | 819200 | ||
100569232 | TadijaSebez | F | Dec. 6, 2020, 4:33 p.m. | OK | GNU C++17 | TESTS | 61 | 46 | 819200 | ||
100571841 | mango_lassi | F | Dec. 6, 2020, 4:47 p.m. | OK | GNU C++17 | TESTS | 61 | 46 | 819200 | ||
100589753 | ShadowLight | F | Dec. 6, 2020, 9:07 p.m. | OK | GNU C++17 | TESTS | 61 | 46 | 819200 | ||
100586070 | nor | F | Dec. 6, 2020, 7:20 p.m. | OK | GNU C++17 | TESTS | 61 | 46 | 819200 | ||
100583353 | timf1089 | F | Dec. 6, 2020, 6:35 p.m. | OK | GNU C++17 | TESTS | 61 | 46 | 819200 | ||
100582416 | cerberus97 | F | Dec. 6, 2020, 6:26 p.m. | OK | GNU C++17 | TESTS | 61 | 46 | 819200 | ||
100569123 | Lawali | F | Dec. 6, 2020, 4:32 p.m. | OK | GNU C++17 | TESTS | 61 | 46 | 921600 | ||
100596581 | momohara | F | Dec. 7, 2020, 3:05 a.m. | OK | GNU C++17 | TESTS | 61 | 46 | 1228800 | ||
100580916 | KingJoffrey | F | Dec. 6, 2020, 5:34 p.m. | OK | GNU C++17 | TESTS | 61 | 46 | 1228800 | ||
100574328 | kessido | F | Dec. 6, 2020, 5 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 31 | 819200 | ||
100599374 | FlowerOfSorrow | F | Dec. 7, 2020, 4:33 a.m. | OK | GNU C++17 (64) | TESTS | 61 | 31 | 819200 | ||
100592928 | smax | F | Dec. 6, 2020, 11:55 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 31 | 1228800 | ||
100578851 | reedef | F | Dec. 6, 2020, 5:25 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 46 | 819200 | ||
100568699 | Giada | F | Dec. 6, 2020, 4:30 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 46 | 819200 | ||
100570170 | GRT_2018 | F | Dec. 6, 2020, 4:38 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 46 | 819200 | ||
100601920 | errorgorn | F | Dec. 7, 2020, 5:34 a.m. | OK | GNU C++17 (64) | TESTS | 61 | 46 | 819200 | ||
100590956 | tfg | F | Dec. 6, 2020, 9:56 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 46 | 819200 | ||
100582471 | Marckess | F | Dec. 6, 2020, 6:26 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 46 | 819200 | ||
100579104 | junie | F | Dec. 6, 2020, 5:27 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 46 | 819200 | ||
100568141 | uwi | F | Dec. 6, 2020, 4:27 p.m. | OK | Java 11 | TESTS | 61 | 202 | 0 | ||
100571430 | iakovlev.zakhar | F | Dec. 6, 2020, 4:45 p.m. | OK | Java 11 | TESTS | 61 | 202 | 0 | ||
100569647 | Lewin | F | Dec. 6, 2020, 4:35 p.m. | OK | Java 11 | TESTS | 61 | 218 | 0 | ||
100566298 | eatmore | F | Dec. 6, 2020, 4:18 p.m. | OK | Java 11 | TESTS | 61 | 233 | 0 | ||
100580413 | tien-nam | F | Dec. 6, 2020, 5:33 p.m. | OK | Java 11 | TESTS | 61 | 358 | 0 | ||
100600092 | MagentaCobra | F | Dec. 7, 2020, 4:52 a.m. | OK | Java 8 | TESTS | 61 | 124 | 0 | ||
100574867 | AkshajK | F | Dec. 6, 2020, 5:03 p.m. | OK | Java 8 | TESTS | 61 | 140 | 0 | ||
100578969 | DarLam | F | Dec. 6, 2020, 5:26 p.m. | OK | Java 8 | TESTS | 61 | 156 | 0 | ||
100568784 | dalt | F | Dec. 6, 2020, 4:31 p.m. | OK | Java 8 | TESTS | 61 | 171 | 0 | ||
100569862 | Hakiobo | F | Dec. 6, 2020, 4:36 p.m. | OK | Kotlin | TESTS | 61 | 155 | 0 | ||
100587568 | Dev.Zaki | F | Dec. 6, 2020, 7:59 p.m. | OK | Kotlin | TESTS | 61 | 187 | 4915200 | ||
100568101 | stgatilov | F | Dec. 6, 2020, 4:27 p.m. | OK | MS C++ 2017 | TESTS | 61 | 46 | 4198400 | ||
100579520 | tarattata1 | F | Dec. 6, 2020, 5:29 p.m. | OK | MS C++ 2017 | TESTS | 61 | 62 | 1740800 | ||
100570060 | gnomina007 | F | Dec. 6, 2020, 4:37 p.m. | OK | MS C++ 2017 | TESTS | 61 | 93 | 3276800 | ||
100575418 | serg3000 | F | Dec. 6, 2020, 5:07 p.m. | OK | MS C++ 2017 | TESTS | 61 | 140 | 5734400 | ||
100574181 | azukun | F | Dec. 6, 2020, 5 p.m. | OK | .NET Core C# | TESTS | 61 | 140 | 14336000 | ||
100571830 | Yupiteru | F | Dec. 6, 2020, 4:47 p.m. | OK | .NET Core C# | TESTS | 61 | 171 | 19046400 | ||
100574251 | keymoon | F | Dec. 6, 2020, 5 p.m. | OK | .NET Core C# | TESTS | 61 | 187 | 12185600 | ||
100583559 | kclee2172 | F | Dec. 6, 2020, 6:38 p.m. | OK | PyPy 3 | TESTS | 61 | 233 | 8806400 | ||
100571031 | titia | F | Dec. 6, 2020, 4:42 p.m. | OK | PyPy 3 | TESTS | 61 | 248 | 10547200 | ||
100575833 | Kiri8128 | F | Dec. 6, 2020, 5:09 p.m. | OK | PyPy 3 | TESTS | 61 | 249 | 10649600 | ||
100585971 | p_143 | F | Dec. 6, 2020, 7:18 p.m. | OK | PyPy 3 | TESTS | 61 | 265 | 8499200 | ||
100578510 | nagiss | F | Dec. 6, 2020, 5:24 p.m. | OK | PyPy 3 | TESTS | 61 | 265 | 10342400 | ||
100572826 | chinerist | F | Dec. 6, 2020, 4:52 p.m. | OK | PyPy 3 | TESTS | 61 | 374 | 11878400 | ||
100591241 | silvertint | F | Dec. 6, 2020, 10:11 p.m. | OK | PyPy 3 | TESTS | 61 | 654 | 11878400 | ||
100566796 | nwi | F | Dec. 6, 2020, 4:21 p.m. | OK | Python 2 | TESTS | 61 | 249 | 5734400 | ||
100589460 | ap1008 | F | Dec. 6, 2020, 8:56 p.m. | OK | Python 2 | TESTS | 61 | 327 | 6553600 | ||
100574191 | GMin1year | F | Dec. 6, 2020, 5 p.m. | OK | Python 2 | TESTS | 61 | 358 | 6451200 | ||
100579143 | sansen | F | Dec. 6, 2020, 5:27 p.m. | OK | Rust | TESTS | 61 | 46 | 5427200 | ||
100568953 | ngtkana | F | Dec. 6, 2020, 4:31 p.m. | OK | Rust | TESTS | 61 | 156 | 4915200 |
Back to search problems