Codeforces Global Round 22

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
1738 Codeforces Global Round 22 FINISHED False 9000 72631463 Sept. 30, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3520 ) D Permutation Addicts PROGRAMMING constructive algorithms dfs and similar ds graphs trees

B'Given a permutation a_1, a_2, ... , a_n of integers from 1 to n , and a threshold k with 0 <= q k <= q n , you compute a sequence b_1, b_2, ... , b_n as follows. For every 1 <= q i <= q n in increasing order, let x = a_i . Unfortunately, after the sequence b_1, b_2, ... , b_n has been completely computed, the permutation a_1, a_2, ... , a_n and the threshold k are discarded. Now you only have the sequence b_1, b_2, ... , b_n . Your task is to find any possible permutation a_1, a_2, ... , a_n and threshold k that produce the sequence b_1, b_2, ... , b_n . It is guaranteed that there exists at least one pair of permutation a_1, a_2, ... , a_n and threshold k that produce the sequence b_1, b_2, ... , b_n . A permutation of integers from 1 to n is a sequence of length n which contains all integers from 1 to n exactly once. Each test contains multiple test cases. The first line contains an integer t ( 1 <= q t <= q 10^5 ) -- the number of test cases. The following lines contain the description of each test case. The first line of each test case contains an integer n ( 1 <= q n <= q 10^5 ), indicating the length of the permutation a . The second line of each test case contains n integers b_1, b_2, ... , b_n ( 0 <= q b_i <= q n+1 ), indicating the elements of the sequence b . It is guaranteed that there exists at least one pair of permutation a_1, a_2, ... , a_n and threshold k that produce the sequence b_1, b_2, ... , b_n . It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, output the threshold k ( 0 <= q k <= q n ) in the first line, and then output the permutation a_1, a_2, ... , a_n ( 1 <= q a_i <= q n ) in the second line such that the permutation a_1, a_2, ... , a_n$$'...

Tutorials

Editorial of Codeforces Global Round <strong>22</strong>

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
174164380 LostTemple D Sept. 30, 2022, 6:30 p.m. OK C# 10 TESTS 52 842 17510400
174160859 rainboy D Sept. 30, 2022, 6:10 p.m. OK GNU C11 TESTS 52 1201 3993600
174148988 xsdjg D Sept. 30, 2022, 4:48 p.m. OK GNU C++14 TESTS 52 46 5017600
174195396 alkido D Oct. 1, 2022, 3:45 a.m. OK GNU C++14 TESTS 52 61 2969600
174194815 Daniel777 D Oct. 1, 2022, 3:36 a.m. OK GNU C++14 TESTS 52 61 3891200
174149979 10000point D Sept. 30, 2022, 4:50 p.m. OK GNU C++14 TESTS 52 61 4300800
174190685 rack_ny D Oct. 1, 2022, 2:26 a.m. OK GNU C++14 TESTS 52 61 4403200
174192555 Krystallos D Oct. 1, 2022, 2:59 a.m. OK GNU C++14 TESTS 52 61 5324800
174191509 echoraven D Oct. 1, 2022, 2:40 a.m. OK GNU C++14 TESTS 52 62 3379200
174148283 howardyang D Sept. 30, 2022, 4:46 p.m. OK GNU C++14 TESTS 52 62 3788800
174168129 lukamosiashvili D Sept. 30, 2022, 7:01 p.m. OK GNU C++14 TESTS 52 62 3788800
174193224 light0love D Oct. 1, 2022, 3:10 a.m. OK GNU C++14 TESTS 52 62 4198400
174190116 emptyset D Oct. 1, 2022, 2:16 a.m. OK GNU C++17 TESTS 52 46 3788800
174186805 zwu2020015020 D Oct. 1, 2022, 1:12 a.m. OK GNU C++17 TESTS 52 61 4403200
174193165 nianheng233 D Oct. 1, 2022, 3:09 a.m. OK GNU C++17 TESTS 52 62 2969600
174187167 hehepig D Oct. 1, 2022, 1:20 a.m. OK GNU C++17 TESTS 52 62 3788800
174191014 prafull_08 D Oct. 1, 2022, 2:31 a.m. OK GNU C++17 TESTS 52 62 3788800
174192169 xuziyuan D Oct. 1, 2022, 2:51 a.m. OK GNU C++17 TESTS 52 62 3993600
174190237 psc233 D Oct. 1, 2022, 2:18 a.m. OK GNU C++17 TESTS 52 62 4198400
174147522 wanghai673 D Sept. 30, 2022, 4:43 p.m. OK GNU C++17 TESTS 52 62 4403200
174189852 anhduc123 D Oct. 1, 2022, 2:11 a.m. OK GNU C++17 TESTS 52 62 4812800
174147761 jason7777 D Sept. 30, 2022, 4:44 p.m. OK GNU C++17 TESTS 52 62 12185600
174199654 Freedom__King D Oct. 1, 2022, 4:47 a.m. OK GNU C++17 (64) TESTS 52 31 26828800
174188432 gqf123 D Oct. 1, 2022, 1:46 a.m. OK GNU C++17 (64) TESTS 52 46 5529600
174192284 yaoveil D Oct. 1, 2022, 2:53 a.m. OK GNU C++17 (64) TESTS 52 46 5529600
174193370 panyanppyy D Oct. 1, 2022, 3:12 a.m. OK GNU C++17 (64) TESTS 52 46 6451200
174154805 LiZnB_love_ZX D Sept. 30, 2022, 5:02 p.m. OK GNU C++17 (64) TESTS 52 46 6963200
174195061 Multiv_Ac D Oct. 1, 2022, 3:40 a.m. OK GNU C++17 (64) TESTS 52 46 11878400
174152473 iloveyu D Sept. 30, 2022, 4:57 p.m. OK GNU C++17 (64) TESTS 52 46 13516800
174160737 haha_ha D Sept. 30, 2022, 6:09 p.m. OK GNU C++17 (64) TESTS 52 46 20275200
174150515 HCPS42 D Sept. 30, 2022, 4:52 p.m. OK GNU C++17 (64) TESTS 52 61 4812800
174181541 Fyind D Sept. 30, 2022, 10:40 p.m. OK GNU C++17 (64) TESTS 52 61 5529600
174194588 Fish_L D Oct. 1, 2022, 3:32 a.m. OK GNU C++20 (64) TESTS 52 46 4198400
174200821 Ghieath D Oct. 1, 2022, 5:02 a.m. OK GNU C++20 (64) TESTS 52 46 4403200
174181312 swift-zym D Sept. 30, 2022, 10:34 p.m. OK GNU C++20 (64) TESTS 52 46 4710400
174179274 Thallium54 D Sept. 30, 2022, 9:45 p.m. OK GNU C++20 (64) TESTS 52 46 4812800
174179177 45muillaht D Sept. 30, 2022, 9:44 p.m. OK GNU C++20 (64) TESTS 52 46 4812800
174199387 Hasnaine_ D Oct. 1, 2022, 4:43 a.m. OK GNU C++20 (64) TESTS 52 46 5120000
174147167 Abdulrahman27 D Sept. 30, 2022, 4:42 p.m. OK GNU C++20 (64) TESTS 52 46 5324800
174149884 monadtransformer D Sept. 30, 2022, 4:50 p.m. OK GNU C++20 (64) TESTS 52 46 5324800
174149845 Kirkon D Sept. 30, 2022, 4:50 p.m. OK GNU C++20 (64) TESTS 52 46 5427200
174203497 Rinors D Oct. 1, 2022, 5:33 a.m. OK GNU C++20 (64) TESTS 52 46 5529600
174150739 kencho D Sept. 30, 2022, 4:53 p.m. OK Java 11 TESTS 52 265 2355200
174182142 Longgggggggg D Sept. 30, 2022, 10:56 p.m. OK Java 11 TESTS 52 312 17203200
174179123 dusty.and.rusty D Sept. 30, 2022, 9:42 p.m. OK Java 11 TESTS 52 1294 14950400
174179480 freehandle D Sept. 30, 2022, 9:49 p.m. OK Java 17 TESTS 52 311 28364800
174179835 dusty.and.rusty D Sept. 30, 2022, 9:57 p.m. OK Java 17 TESTS 52 701 14643200
174179914 dusty.and.rusty D Sept. 30, 2022, 9:58 p.m. OK Java 17 TESTS 52 935 14438400
174181331 dusty.and.rusty D Sept. 30, 2022, 10:34 p.m. OK Java 17 TESTS 52 982 14643200
174181969 dusty.and.rusty D Sept. 30, 2022, 10:52 p.m. OK Java 17 TESTS 52 1029 13824000
174180618 dusty.and.rusty D Sept. 30, 2022, 10:15 p.m. OK Java 17 TESTS 52 1325 13926400
174182001 dusty.and.rusty D Sept. 30, 2022, 10:53 p.m. OK Java 17 TESTS 52 1450 15360000
174179557 dusty.and.rusty D Sept. 30, 2022, 9:51 p.m. OK Java 17 TESTS 52 1450 15360000
174179665 dusty.and.rusty D Sept. 30, 2022, 9:53 p.m. OK Java 17 TESTS 52 1450 16281600
174181912 dusty.and.rusty D Sept. 30, 2022, 10:50 p.m. OK Java 17 TESTS 52 1528 15052800
174169548 megaspazz D Sept. 30, 2022, 7:16 p.m. OK Java 8 TESTS 52 186 16384000
174169885 megaspazz D Sept. 30, 2022, 7:19 p.m. OK Java 8 TESTS 52 186 16588800
174169753 megaspazz D Sept. 30, 2022, 7:18 p.m. OK Java 8 TESTS 52 187 16588800
174172242 megaspazz D Sept. 30, 2022, 7:49 p.m. OK Java 8 TESTS 52 202 16588800
174169785 megaspazz D Sept. 30, 2022, 7:18 p.m. OK Java 8 TESTS 52 202 30924800
174169476 megaspazz D Sept. 30, 2022, 7:15 p.m. OK Java 8 TESTS 52 233 18124800
174151323 cardiacpack1983 D Sept. 30, 2022, 4:54 p.m. OK Java 8 TESTS 52 248 14233600
174169216 megaspazz D Sept. 30, 2022, 7:12 p.m. OK Java 8 TESTS 52 295 51609600
174169724 megaspazz D Sept. 30, 2022, 7:17 p.m. OK Java 8 TESTS 52 311 74342400
174169394 megaspazz D Sept. 30, 2022, 7:14 p.m. OK Java 8 TESTS 52 311 75161600
174162881 arvindf232 D Sept. 30, 2022, 6:21 p.m. OK Kotlin 1.6 TESTS 52 343 14540800
174161421 misorin D Sept. 30, 2022, 6:13 p.m. OK PyPy 3 TESTS 52 280 26112000
174160787 9.86960440109 D Sept. 30, 2022, 6:10 p.m. OK PyPy 3 TESTS 52 467 22220800
174168493 Wendy0317 D Sept. 30, 2022, 7:05 p.m. OK PyPy 3-64 TESTS 52 218 30412800
174151211 duck702702 D Sept. 30, 2022, 4:54 p.m. OK PyPy 3-64 TESTS 52 311 22425600
174171359 DeathIsAwe D Sept. 30, 2022, 7:37 p.m. OK PyPy 3-64 TESTS 52 311 24268800
174184088 shotoyoo D Oct. 1, 2022, 12:06 a.m. OK PyPy 3-64 TESTS 52 467 33484800
174151401 dyppp D Sept. 30, 2022, 4:54 p.m. OK PyPy 3-64 TESTS 52 514 27136000

remove filters

Back to search problems