Codeforces Round 740 (Div. 1, based on VK Cup 2021 - Final (Engine))

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
1558 Codeforces Round 740 (Div. 1, based on VK Cup 2021 - Final (Engine)) FINISHED False 9000 107364263 Aug. 24, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 400 ) F Strange Sort PROGRAMMING data structures sortings 3300

B"You have a permutation: an array a = [a_1, a_2, ldots, a_n] of distinct integers from 1 to n . The length of the permutation n is odd. Consider the following algorithm of sorting the permutation in increasing order. A helper procedure of the algorithm, f(i) , takes a single argument i ( 1 <= i <= n-1 ) and does the following. If a_i > a_{i+1} , the values of a_i and a_{i+1} are exchanged. Otherwise, the permutation doesn't change. The algorithm consists of iterations, numbered with consecutive integers starting with 1 . On the i -th iteration, the algorithm does the following: It can be proven that after a finite number of iterations the permutation will be sorted in increasing order. After how many iterations will this happen for the first time? Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). Description of the test cases follows. The first line of each test case contains a single integer n ( 3 <= n <= 2 cdot 10^5 - 1 ; n is odd) -- the length of the permutation. The second line contains n distinct integers a_1, a_2, ldots, a_n ( 1 <= a_i <= n ) -- the permutation itself. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 - 1 . For each test case print the number of iterations after which the permutation will become sorted in increasing order for the first time. If the given permutation is already sorted, print 0 . In the first test case, the permutation will be changing as follows: In the second test case, the permutation will be changing as follows: In the third test case, the permutation is already sorted and the answer is 0 . "...

Tutorials

Codeforces Round #740 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
126913762 rainboy F Aug. 24, 2021, 7:31 p.m. OK GNU C11 TESTS 128 108 9523200 3300
126959855 _ztyqwq F Aug. 25, 2021, 10:32 a.m. OK GNU C++14 TESTS 128 171 11980800 3300
126929393 C2020jzm F Aug. 25, 2021, 3:34 a.m. OK GNU C++14 TESTS 128 295 10956800 3300
126978258 CunFu_ZhuGe F Aug. 25, 2021, 2:38 p.m. OK GNU C++14 TESTS 128 311 19148800 3300
126888389 peehs_moorhsum F Aug. 24, 2021, 4:12 p.m. OK GNU C++14 TESTS 128 343 19148800 3300
126902212 gisp_zjz F Aug. 24, 2021, 4:56 p.m. OK GNU C++14 TESTS 128 685 52838400 3300
126912282 Leeisateam F Aug. 24, 2021, 7:03 p.m. OK GNU C++17 TESTS 128 93 12595200 3300
126912271 Leeisateam F Aug. 24, 2021, 7:02 p.m. OK GNU C++17 TESTS 128 93 12595200 3300
126912258 Leeisateam F Aug. 24, 2021, 7:02 p.m. OK GNU C++17 TESTS 128 93 12595200 3300
126912252 Leeisateam F Aug. 24, 2021, 7:02 p.m. OK GNU C++17 TESTS 128 93 12595200 3300
126912208 Leeisateam F Aug. 24, 2021, 7:02 p.m. OK GNU C++17 TESTS 128 93 12595200 3300
126912199 Leeisateam F Aug. 24, 2021, 7:01 p.m. OK GNU C++17 TESTS 128 93 12595200 3300
126912188 Leeisateam F Aug. 24, 2021, 7:01 p.m. OK GNU C++17 TESTS 128 93 12595200 3300
126912341 Leeisateam F Aug. 24, 2021, 7:04 p.m. OK GNU C++17 TESTS 128 93 12595200 3300
126912346 Leeisateam F Aug. 24, 2021, 7:04 p.m. OK GNU C++17 TESTS 128 108 12595200 3300
126916564 Bogdan_feysa F Aug. 24, 2021, 8:39 p.m. OK GNU C++17 TESTS 128 108 12595200 3300
126961059 orzdevinwang F Aug. 25, 2021, 10:49 a.m. OK GNU C++17 (64) TESTS 128 124 13209600 3300
126890640 ecnerwala F Aug. 24, 2021, 4:19 p.m. OK GNU C++17 (64) TESTS 128 155 9932800 3300
126894123 yosupo F Aug. 24, 2021, 4:29 p.m. OK GNU C++17 (64) TESTS 128 155 11571200 3300
126979730 ToToMI F Aug. 25, 2021, 2:55 p.m. OK GNU C++17 (64) TESTS 128 156 12492800 3300
126946970 wasa855 F Aug. 25, 2021, 7:44 a.m. OK GNU C++17 (64) TESTS 128 171 13107200 3300
126907204 noshi91 F Aug. 24, 2021, 5:58 p.m. OK GNU C++17 (64) TESTS 128 171 21299200 3300
126907529 jiangIy F Aug. 24, 2021, 6 p.m. OK GNU C++17 (64) TESTS 128 202 10444800 3300
126902100 maroonrk F Aug. 24, 2021, 4:56 p.m. OK GNU C++17 (64) TESTS 128 249 28262400 3300
126899482 ksun48 F Aug. 24, 2021, 4:47 p.m. OK GNU C++17 (64) TESTS 128 264 26931200 3300
126979673 q-w-q-w-q F Aug. 25, 2021, 2:54 p.m. OK GNU C++17 (64) TESTS 128 280 18739200 3300

remove filters

Back to search problems