Codeforces Round 945 (Div. 2)

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
1973 Codeforces Round 945 (Div. 2) FINISHED False 7200 21223463 May 17, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8634 ) C Cat, Fox and Double Maximum PROGRAMMING constructive algorithms greedy implementation math sortings 1700

B"Fox loves permutations! She came up with the following problem and asked Cat to solve it: You are given an even positive integer n and a permutation ^ dagger p of length n . The score of another permutation q of length n is the number of local maximums in the array a of length n , where a_i = p_i + q_i for all i ( 1 <= i <= n ). In other words, the score of q is the number of i such that 1 < i < n (note the strict inequalities), a_{i-1} < a_i , and a_i > a_{i+1} (once again, note the strict inequalities). Find the permutation q that achieves the maximum score for given n and p . If there exist multiple such permutations, you can pick any of them. ^ dagger A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 appears twice in the array), and [1,3,4] is also not a permutation ( n=3 but there is 4 in the array). The first line of input contains an integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases in the input you will have to solve. The first line of each test case contains one even integer n ( 4 <= q n <= q 10^5 , n is even) -- the length of the permutation p . The second line of each test case contains the n integers p_1, p_2, ldots, p_n ( 1 <= q p_i <= q n ). It is guaranteed that p is a permutation of length n . It is guaranteed that the sum of n across all test cases doesn't exceed 10^5 . For each test case, output one line containing any permutation of length n (the array q ), such that q maximizes the score under the given constraints. In the first example, a = [3, 6, 4, 7] . The array has just one local maximum (on the second position), so the sco"...

Tutorials

Editorial for Codeforces Round #945 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
261708147 Aiden121pearce C May 19, 2024, 11:03 p.m. OK C# 10 TESTS 8 124 17203200 1700
261980378 Anastasiya_Andreevna C May 21, 2024, 8:12 a.m. OK C# 10 TESTS 8 124 19046400 1700
263164387 elegantCoder C May 29, 2024, 3:45 p.m. OK C++14 (GCC 6-32) TESTS 8 77 0 1700
262699323 clashrover C May 26, 2024, 11:54 a.m. OK C++14 (GCC 6-32) TESTS 8 77 0 1700
261694330 anuragiitr C May 19, 2024, 6:58 p.m. OK C++14 (GCC 6-32) TESTS 8 77 0 1700
262684770 Errors C May 26, 2024, 9:55 a.m. OK C++14 (GCC 6-32) TESTS 8 77 102400 1700
262172441 adarshnim30 C May 22, 2024, 4:53 p.m. OK C++14 (GCC 6-32) TESTS 8 77 819200 1700
262999613 NJ_438 C May 28, 2024, 11:06 a.m. OK C++14 (GCC 6-32) TESTS 8 77 921600 1700
262811640 zxc309 C May 27, 2024, 1:10 a.m. OK C++14 (GCC 6-32) TESTS 8 77 1228800 1700
261945014 Grammar_hbw C May 21, 2024, 12:22 a.m. OK C++14 (GCC 6-32) TESTS 8 77 1638400 1700
263407981 vjudge2 C May 31, 2024, 4:19 a.m. OK C++14 (GCC 6-32) TESTS 8 77 1638400 1700
261944976 Grammar_hbw C May 21, 2024, 12:21 a.m. OK C++14 (GCC 6-32) TESTS 8 77 1638400 1700
262925764 VaibhavG_999 C May 27, 2024, 7:06 p.m. OK C++17 (GCC 7-32) TESTS 8 61 0 1700
262933567 Mayur_coder C May 27, 2024, 8:57 p.m. OK C++17 (GCC 7-32) TESTS 8 61 0 1700
262920419 keerthanyadav23 C May 27, 2024, 6:08 p.m. OK C++17 (GCC 7-32) TESTS 8 61 0 1700
262170968 Kritik12 C May 22, 2024, 4:40 p.m. OK C++17 (GCC 7-32) TESTS 8 62 0 1700
262863921 theoriginalshyam C May 27, 2024, 10:26 a.m. OK C++17 (GCC 7-32) TESTS 8 62 0 1700
262318182 hhwu C May 23, 2024, 11:24 p.m. OK C++17 (GCC 7-32) TESTS 8 62 0 1700
262265137 shrigma.dev C May 23, 2024, 1:28 p.m. OK C++17 (GCC 7-32) TESTS 8 62 0 1700
261949946 akat C May 21, 2024, 1:59 a.m. OK C++17 (GCC 7-32) TESTS 8 62 0 1700
261987237 sakibcodeforces C May 21, 2024, 9:03 a.m. OK C++17 (GCC 7-32) TESTS 8 62 102400 1700
262079792 hongjinjian C May 22, 2024, 2:59 a.m. OK C++17 (GCC 7-32) TESTS 8 62 1228800 1700
262142704 N_z__ C May 22, 2024, 12:13 p.m. OK C++20 (GCC 13-64) TESTS 8 46 102400 1700
262235223 hero_of_math_and_magic C May 23, 2024, 9:39 a.m. OK C++20 (GCC 13-64) TESTS 8 61 0 1700
261895989 Seraphic C May 20, 2024, 4:31 p.m. OK C++20 (GCC 13-64) TESTS 8 61 0 1700
261921250 islingr C May 20, 2024, 6:10 p.m. OK C++20 (GCC 13-64) TESTS 8 61 0 1700
262662090 jiangly C May 26, 2024, 6:57 a.m. OK C++20 (GCC 13-64) TESTS 8 61 0 1700
262413631 shubhamphpefy C May 24, 2024, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 8 61 0 1700
262433584 Pleitehuenas C May 24, 2024, 7:58 p.m. OK C++20 (GCC 13-64) TESTS 8 61 1024000 1700
262280058 rythmkumar232 C May 23, 2024, 3:29 p.m. OK C++20 (GCC 13-64) TESTS 8 61 2457600 1700
263669603 rliu4936 C June 1, 2024, 6:23 p.m. OK C++20 (GCC 13-64) TESTS 8 62 0 1700
263660263 NeoRise_ C June 1, 2024, 4:58 p.m. OK C++20 (GCC 13-64) TESTS 8 62 0 1700
261730732 bluemegane C May 20, 2024, 6:36 a.m. OK C# 8 TESTS 8 202 17920000 1700
262330807 Anonymous_HF C May 24, 2024, 4 a.m. OK GNU C11 TESTS 8 421 1740800 1700
262084060 light616 C May 22, 2024, 4:05 a.m. OK GNU C11 TESTS 8 437 3276800 1700
262844273 nguyenquocthao00 C May 27, 2024, 7:37 a.m. OK Go TESTS 8 92 8499200 1700
261713465 october_rain C May 20, 2024, 1:57 a.m. OK Haskell TESTS 8 780 32563200 1700
262438347 danielfleischman C May 24, 2024, 9:12 p.m. OK Haskell TESTS 8 1062 87142400 1700
261791514 believe18 C May 20, 2024, 2:11 p.m. OK Java 21 TESTS 8 281 819200 1700
261783195 kritikmodi C May 20, 2024, 1:04 p.m. OK Java 21 TESTS 8 281 819200 1700
262250180 d2s2 C May 23, 2024, 11:43 a.m. OK Java 21 TESTS 8 296 512000 1700
263055584 stolis C May 28, 2024, 6:54 p.m. OK Java 21 TESTS 8 296 819200 1700
262878582 c1415926 C May 27, 2024, 12:22 p.m. OK Java 21 TESTS 8 296 921600 1700
261977173 Zhanzhe_Lee C May 21, 2024, 7:43 a.m. OK Java 21 TESTS 8 312 819200 1700
262002401 sagbis C May 21, 2024, 10:58 a.m. OK Java 21 TESTS 8 374 1740800 1700
262526144 Omar_Morsi C May 25, 2024, 2:43 p.m. OK Java 21 TESTS 8 405 2048000 1700
263049541 sudhanshu64 C May 28, 2024, 5:55 p.m. OK Java 21 TESTS 8 468 7884800 1700
262717043 oneafter C May 26, 2024, 2:34 p.m. OK Java 21 TESTS 8 483 9420800 1700
261760949 wat2 C May 20, 2024, 10:05 a.m. OK Java 8 TESTS 8 249 15872000 1700
262492309 Dhruvin_Savla C May 25, 2024, 9:56 a.m. OK Java 8 TESTS 8 296 0 1700
262504065 kl_2200031074 C May 25, 2024, 11:39 a.m. OK Java 8 TESTS 8 343 6860800 1700
262303291 Baidiki C May 23, 2024, 6:52 p.m. OK Java 8 TESTS 8 437 0 1700
261701199 abbasslb C May 19, 2024, 8:36 p.m. OK Java 8 TESTS 8 703 7577600 1700
261705499 abbasslb C May 19, 2024, 9:56 p.m. OK Java 8 TESTS 8 780 9523200 1700
262360782 linxiaotian C May 24, 2024, 9:15 a.m. OK Kotlin 1.9 TESTS 8 312 7782400 1700
262618313 alibichgaleleyev C May 25, 2024, 7:30 p.m. OK Kotlin 1.9 TESTS 8 593 19456000 1700
262626550 shadonra Whosyourjay C May 25, 2024, 9:20 p.m. OK PyPy 3 TESTS 8 467 15769600 1700
262445301 mortezamalekey C May 25, 2024, 12:29 a.m. OK PyPy 3 TESTS 8 562 11059200 1700
262166456 Kokoa_Chino C May 22, 2024, 4:01 p.m. OK PyPy 3-64 TESTS 8 124 15564800 1700
262269544 bergus C May 23, 2024, 2:02 p.m. OK PyPy 3-64 TESTS 8 140 14643200 1700
262029125 strashila C May 21, 2024, 1:57 p.m. OK PyPy 3-64 TESTS 8 155 14028800 1700
262261321 bergus C May 23, 2024, 1 p.m. OK PyPy 3-64 TESTS 8 187 18022400 1700
262211103 Yuvraj_2004 C May 23, 2024, 3:05 a.m. OK PyPy 3-64 TESTS 8 217 10240000 1700
262662347 poornaTheja C May 26, 2024, 6:59 a.m. OK PyPy 3-64 TESTS 8 218 15974400 1700
263430080 2024_how_to_practice C May 31, 2024, 7:34 a.m. OK PyPy 3-64 TESTS 8 233 16384000 1700
261694409 kunalseth C May 19, 2024, 6:59 p.m. OK PyPy 3-64 TESTS 8 233 17715200 1700
262064462 griffith911 C May 21, 2024, 9:41 p.m. OK PyPy 3-64 TESTS 8 233 18944000 1700
262360078 dijkstra_bull C May 24, 2024, 9:09 a.m. OK PyPy 3-64 TESTS 8 233 19148800 1700
262496449 2210080018 C May 25, 2024, 10:30 a.m. OK Python 3 TESTS 8 234 14643200 1700
262352407 luogu_bot3 C May 24, 2024, 8:03 a.m. OK Python 3 TESTS 8 249 16076800 1700
262690073 VerEfr C May 26, 2024, 10:39 a.m. OK Python 3 TESTS 8 249 17817600 1700
262405518 NS3081992 C May 24, 2024, 3:18 p.m. OK Python 3 TESTS 8 296 24166400 1700
262859870 _sheep_ C May 27, 2024, 9:50 a.m. OK Rust 2021 TESTS 8 46 819200 1700
261703429 Svlad_Cjelli C May 19, 2024, 9:13 p.m. OK Rust 2021 TESTS 8 62 204800 1700
262313519 Cheshulko C May 23, 2024, 9:22 p.m. OK Rust 2021 TESTS 8 77 5017600 1700
263165008 bqn C May 29, 2024, 3:51 p.m. OK Rust 2021 TESTS 8 77 5939200 1700

remove filters

Back to search problems