Codeforces Round 838 (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
1762 Codeforces Round 838 (Div. 2) FINISHED False 9000 60708299 Dec. 15, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 102 ) G Unequal Adjacent Elements PROGRAMMING constructive algorithms sortings

B'You are given an array a consisting of n positive integers. Find any permutation p of [1,2, ... ,n] such that: Or report that no such permutation exists. Each test contains multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 10^5 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 3 <= q n <= q 3 cdot 10^5 ) -- the length of the array a . The second line of each test case contains n space-separated integers a_1,a_2, ldots,a_n ( 1 <= q a_i <= q n ) -- representing the array a . It is guaranteed that the sum of n over all test cases does not exceed 3 cdot 10^5 . For each test case, output "NO" if no such permutation exists, otherwise output "YES" in the first line and print the permutation p in the next line. In case there are multiple permutations, print any one of them. You can output "YES" and "NO" in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive response). In the first test case, p=[1,2,3] is the only permutation of [1,2,3] that satisfy the given constraints. In the second test case, [1,3,2,4] , [2,1,4,3] and some other permutations are also acceptable. In the third test case, it can be proved that there does not exist any permutation of [1,2,3] satisfying the given constraints. '...

Tutorials

Codeforces Round #838 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
185374221 mguliyev12360 G Dec. 15, 2022, 5:39 p.m. OK GNU C++17 TESTS 88 93 5120000
185401329 peti1234 G Dec. 16, 2022, 12:09 a.m. OK GNU C++17 TESTS 88 358 9011200
185401284 peti1234 G Dec. 16, 2022, 12:07 a.m. OK GNU C++17 TESTS 88 358 9011200
185375748 farhanLabib2537 G Dec. 15, 2022, 5:49 p.m. OK GNU C++17 (64) TESTS 88 109 5017600
185406993 Origenes G Dec. 16, 2022, 2:48 a.m. OK GNU C++17 (64) TESTS 88 109 6656000
185416462 wygzgyw G Dec. 16, 2022, 5:39 a.m. OK GNU C++17 (64) TESTS 88 156 12288000
185405713 BeyondHeaven G Dec. 16, 2022, 2:17 a.m. OK GNU C++17 (64) TESTS 88 467 28569600
185409628 Alphaqwq_ G Dec. 16, 2022, 3:51 a.m. OK GNU C++20 (64) TESTS 88 389 19456000
185377497 dmenezes G Dec. 15, 2022, 6:02 p.m. OK GNU C++20 (64) TESTS 88 514 31129600
185401836 dmenezes G Dec. 16, 2022, 12:27 a.m. OK GNU C++20 (64) TESTS 88 561 12185600
185400624 satyam_343 G Dec. 15, 2022, 11:42 p.m. OK GNU C++20 (64) TESTS 88 561 12185600
185363894 antontrygubO_o G Dec. 15, 2022, 4:48 p.m. OK GNU C++20 (64) TESTS 88 935 36147200

remove filters

Back to search problems