Codeforces Round 842 (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
1768 Codeforces Round 842 (Div. 2) FINISHED False 7200 58893899 Jan. 5, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 14299 ) C Elemental Decompress PROGRAMMING constructive algorithms greedy implementation sortings

B'You are given an array a of n integers. Find two permutations ^ dagger p and q of length n such that max(p_i,q_i)=a_i for all 1 <= q i <= q n or report that such p and q do not exist. ^ 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 contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 2 cdot 10^5 ). The second line of each test case contains n integers a_1,a_2, ldots,a_n ( 1 <= q a_i <= q n ) -- the array a . It is guaranteed that the total sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, if there do not exist p and q that satisfy the conditions, output "NO" (without quotes). Otherwise, output "YES" (without quotes) and then output 2 lines. The first line should contain n integers p_1,p_2, ldots,p_n and the second line should contain n integers q_1,q_2, ldots,q_n . If there are multiple solutions, you may output any of them. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response). In the first test case, p=q=[1] . It is correct since a_1 = max(p_1,q_1) = 1 . In the second test case, p=[1,3,4,2,5] and q=[5,2,3,1,4] . It is correct since: In the third test case, one can show that no such p and q exist. '...

Tutorials

Codeforces Round #842 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
188153381 Wizard_of_Orz C Jan. 6, 2023, 1:13 a.m. OK Clang++17 Diagnostics TESTS 38 717 23961600
188119092 1435730 C Jan. 5, 2023, 4:29 p.m. OK GNU C11 TESTS 36 108 4812800
188117336 Harry_03 C Jan. 5, 2023, 4:25 p.m. OK GNU C11 TESTS 36 1731 5632000
188163329 Lonen C Jan. 6, 2023, 4:34 a.m. OK GNU C++14 TESTS 38 109 5222400
188163215 Zero_L C Jan. 6, 2023, 4:32 a.m. OK GNU C++14 TESTS 38 109 7577600
188140702 StupidGuy13 C Jan. 5, 2023, 7:39 p.m. OK GNU C++14 TESTS 38 109 8192000
188118758 zhangas C Jan. 5, 2023, 4:29 p.m. OK GNU C++14 TESTS 36 124 4403200
188116586 shinzanmono C Jan. 5, 2023, 4:24 p.m. OK GNU C++14 TESTS 36 124 5017600
188153732 Shukuang C Jan. 6, 2023, 1:23 a.m. OK GNU C++14 TESTS 38 124 5017600
188153747 jiangnan123 C Jan. 6, 2023, 1:24 a.m. OK GNU C++14 TESTS 38 124 5632000
188153403 jiangnan123 C Jan. 6, 2023, 1:14 a.m. OK GNU C++14 TESTS 38 124 5632000
188163659 jifbt C Jan. 6, 2023, 4:39 a.m. OK GNU C++14 TESTS 38 124 5632000
188156275 _ChiFAN_ C Jan. 6, 2023, 2:27 a.m. OK GNU C++14 TESTS 38 124 5632000
188151918 hongshen C Jan. 6, 2023, 12:25 a.m. OK GNU C++17 TESTS 38 108 7577600
188115645 junha1282 C Jan. 5, 2023, 4:21 p.m. OK GNU C++17 TESTS 36 109 4812800
188151826 N0fal C Jan. 6, 2023, 12:21 a.m. OK GNU C++17 TESTS 38 109 5734400
188154215 s2003 C Jan. 6, 2023, 1:37 a.m. OK GNU C++17 TESTS 38 109 7577600
188139684 HOLlC C Jan. 5, 2023, 7:24 p.m. OK GNU C++17 TESTS 38 109 60108800
188161182 9750183737_HiepNH C Jan. 6, 2023, 3:58 a.m. OK GNU C++17 TESTS 38 124 3276800
188134940 WildWeasel C Jan. 5, 2023, 6:29 p.m. OK GNU C++17 TESTS 38 124 4096000
188153823 TJSW C Jan. 6, 2023, 1:26 a.m. OK GNU C++17 TESTS 38 124 4812800
188163201 duoluoluo C Jan. 6, 2023, 4:32 a.m. OK GNU C++17 TESTS 38 124 4812800
188159894 Touchlion C Jan. 6, 2023, 3:36 a.m. OK GNU C++17 TESTS 38 124 5017600
188154560 past_last C Jan. 6, 2023, 1:46 a.m. OK GNU C++17 (64) TESTS 38 77 72192000
188155123 luogu_bot3 C Jan. 6, 2023, 2:02 a.m. OK GNU C++17 (64) TESTS 38 93 5836800
188167944 JYJin C Jan. 6, 2023, 5:34 a.m. OK GNU C++17 (64) TESTS 38 93 6451200
188119409 SugarT C Jan. 5, 2023, 4:30 p.m. OK GNU C++17 (64) TESTS 36 93 9523200
188117261 dinzihan C Jan. 5, 2023, 4:25 p.m. OK GNU C++17 (64) TESTS 36 93 9625600
188118927 BetoSCL C Jan. 5, 2023, 4:29 p.m. OK GNU C++17 (64) TESTS 36 93 10137600
188143007 mesbah19 C Jan. 5, 2023, 8:15 p.m. OK GNU C++17 (64) TESTS 38 93 10444800
188149670 yl_neo C Jan. 5, 2023, 10:59 p.m. OK GNU C++17 (64) TESTS 38 93 12083200
188155381 Hytidel C Jan. 6, 2023, 2:07 a.m. OK GNU C++17 (64) TESTS 38 108 4096000
188152863 urBCI C Jan. 6, 2023, 12:56 a.m. OK GNU C++17 (64) TESTS 38 108 8294400
188136527 leoanjos C Jan. 5, 2023, 6:45 p.m. OK GNU C++20 (64) TESTS 38 62 3276800
188134572 Marawan_Mohamed C Jan. 5, 2023, 6:26 p.m. OK GNU C++20 (64) TESTS 38 62 5836800
188125975 mrkhan2000 C Jan. 5, 2023, 5:32 p.m. OK GNU C++20 (64) TESTS 36 62 6451200
188153444 OPF10 C Jan. 6, 2023, 1:15 a.m. OK GNU C++20 (64) TESTS 38 77 4096000
188144361 ibrm C Jan. 5, 2023, 8:39 p.m. OK GNU C++20 (64) TESTS 38 77 4812800
188169239 zerofafa C Jan. 6, 2023, 5:49 a.m. OK GNU C++20 (64) TESTS 38 77 4812800
188136321 leoanjos C Jan. 5, 2023, 6:43 p.m. OK GNU C++20 (64) TESTS 38 77 4812800
188152723 RetsaZC19 C Jan. 6, 2023, 12:51 a.m. OK GNU C++20 (64) TESTS 38 77 5632000
188137831 aditya060 C Jan. 5, 2023, 7:01 p.m. OK GNU C++20 (64) TESTS 38 77 7475200
188159213 0821010560HaiND C Jan. 6, 2023, 3:23 a.m. OK GNU C++20 (64) TESTS 38 77 8192000
188151807 wantu C Jan. 6, 2023, 12:20 a.m. OK Java 11 TESTS 38 358 10547200
188158098 HMETAO C Jan. 6, 2023, 3:03 a.m. OK Java 11 TESTS 38 451 18636800
188168143 insane_banda C Jan. 6, 2023, 5:37 a.m. OK Java 11 TESTS 38 451 28774400
188128198 kartik__sethi C Jan. 5, 2023, 5:42 p.m. OK Java 11 TESTS 38 623 24371200
188135654 pushkar.lonkar21 C Jan. 5, 2023, 6:36 p.m. OK Java 11 TESTS 38 686 40448000
188165853 paras3019 C Jan. 6, 2023, 5:09 a.m. OK Java 11 TESTS 38 717 23244800
188142464 snowytank C Jan. 5, 2023, 8:06 p.m. OK Java 11 TESTS 38 732 50073600
188125814 KhadijaBadrawy C Jan. 5, 2023, 5:32 p.m. OK Java 11 TESTS 36 764 39014400
188144140 Shabab_kabab C Jan. 5, 2023, 8:35 p.m. OK Java 11 TESTS 38 810 33484800
188141952 ilasiawo C Jan. 5, 2023, 7:58 p.m. OK Java 11 TESTS 38 1014 41676800
188144329 Diptiman99 C Jan. 5, 2023, 8:38 p.m. OK Java 17 TESTS 38 358 35942400
188116703 harman1148 C Jan. 5, 2023, 4:24 p.m. OK Java 17 TESTS 36 420 12902400
188170086 jameszhangrg C Jan. 6, 2023, 5:58 a.m. OK Java 17 TESTS 38 421 13721600
188138005 ayushdragneel27 C Jan. 5, 2023, 7:02 p.m. OK Java 17 TESTS 38 498 8806400
188135959 merlin_ C Jan. 5, 2023, 6:39 p.m. OK Java 17 TESTS 38 576 43929600
188139324 im_Yash24 C Jan. 5, 2023, 7:20 p.m. OK Java 17 TESTS 38 670 52019200
188140369 this.is.shivamsingh C Jan. 5, 2023, 7:34 p.m. OK Java 17 TESTS 38 748 40140800
188127806 not_just_rr C Jan. 5, 2023, 5:40 p.m. OK Java 17 TESTS 38 794 60620800
188159771 Suraj1607 C Jan. 6, 2023, 3:34 a.m. OK Java 17 TESTS 38 1825 33689600
188168112 imprayas12 C Jan. 6, 2023, 5:36 a.m. OK Java 17 TESTS 38 1825 39936000
188168270 _Eyepatch C Jan. 6, 2023, 5:38 a.m. OK Java 8 TESTS 38 327 26931200
188140457 abhayrajnegi0416 C Jan. 5, 2023, 7:35 p.m. OK Java 8 TESTS 38 467 34713600
188153790 -crazy_coder- C Jan. 6, 2023, 1:25 a.m. OK Java 8 TESTS 38 483 55910400
188136932 Imran435 C Jan. 5, 2023, 6:49 p.m. OK Java 8 TESTS 38 483 62259200
188137299 Imran435 C Jan. 5, 2023, 6:54 p.m. OK Java 8 TESTS 38 498 62156800
188138255 Virendra115 C Jan. 5, 2023, 7:06 p.m. OK Java 8 TESTS 38 499 30208000
188168207 lpychemistry C Jan. 6, 2023, 5:37 a.m. OK Java 8 TESTS 38 545 24268800
188150935 ZakiKurdya C Jan. 5, 2023, 11:47 p.m. OK Java 8 TESTS 38 545 31129600
188118521 amaturecoder C Jan. 5, 2023, 4:28 p.m. OK Java 8 TESTS 36 608 63897600
188169068 nikhil97agra C Jan. 6, 2023, 5:47 a.m. OK Java 8 TESTS 38 638 62771200
188120425 cest_lavie C Jan. 5, 2023, 4:32 p.m. OK MS C++ 2017 TESTS 36 296 20172800
188137367 Galina_Basalova C Jan. 5, 2023, 6:55 p.m. OK MS C++ 2017 TESTS 38 421 8089600
188167005 ishybee C Jan. 6, 2023, 5:24 a.m. OK MS C++ 2017 TESTS 38 436 6451200
188117376 xxr C Jan. 5, 2023, 4:25 p.m. OK MS C++ 2017 TESTS 36 561 20377600
188165787 1_shivam C Jan. 6, 2023, 5:08 a.m. OK MS C++ 2017 TESTS 38 717 28467200
188132773 Ghostdog C Jan. 5, 2023, 6:11 p.m. OK MS C++ 2017 TESTS 38 733 21299200
188127847 30SK5 C Jan. 5, 2023, 5:40 p.m. OK MS C++ 2017 TESTS 38 842 21811200
188121935 maxK99 C Jan. 5, 2023, 4:34 p.m. OK MS C++ 2017 TESTS 36 1013 21811200
188118362 jonathan-chen10 C Jan. 5, 2023, 4:28 p.m. OK Node.js TESTS 36 389 57856000
188129037 rsFalse C Jan. 5, 2023, 5:47 p.m. OK Perl TESTS 38 858 106496000
188117116 rsFalse C Jan. 5, 2023, 4:25 p.m. OK Perl TESTS 36 1185 112742400
188127473 Mohamed_Hamed C Jan. 5, 2023, 5:38 p.m. OK PyPy 3 TESTS 36 966 50278400
188146203 sami02jain C Jan. 5, 2023, 9:16 p.m. OK PyPy 3 TESTS 38 997 43520000
188137101 SophieHatter C Jan. 5, 2023, 6:51 p.m. OK PyPy 3-64 TESTS 38 280 42905600
188142447 gardengnome C Jan. 5, 2023, 8:05 p.m. OK PyPy 3-64 TESTS 38 342 57856000
188153528 RobinFromTheHood C Jan. 6, 2023, 1:17 a.m. OK PyPy 3-64 TESTS 38 343 72089600
188120558 skull.zju C Jan. 5, 2023, 4:32 p.m. OK PyPy 3-64 TESTS 36 374 50073600
188127105 ankit_x C Jan. 5, 2023, 5:36 p.m. OK PyPy 3-64 TESTS 36 389 57036800
188137661 pratyush155 C Jan. 5, 2023, 6:58 p.m. OK PyPy 3-64 TESTS 38 405 52326400
188129566 jalaj21 C Jan. 5, 2023, 5:50 p.m. OK PyPy 3-64 TESTS 38 452 63488000
188150818 MohamedTaha C Jan. 5, 2023, 11:43 p.m. OK PyPy 3-64 TESTS 38 499 48844800
188133496 darkl0rd C Jan. 5, 2023, 6:17 p.m. OK PyPy 3-64 TESTS 38 514 56115200
188118524 Hyunsung C Jan. 5, 2023, 4:28 p.m. OK PyPy 3-64 TESTS 36 530 54374400
188164702 HCISY C Jan. 6, 2023, 4:54 a.m. OK Python 3 TESTS 38 779 43212800
188152431 kollabhargavre1 C Jan. 6, 2023, 12:43 a.m. OK Python 3 TESTS 38 857 25395200
188154980 pshubham.me C Jan. 6, 2023, 1:57 a.m. OK Python 3 TESTS 38 873 42700800
188126440 VictorS C Jan. 5, 2023, 5:34 p.m. OK Python 3 TESTS 36 935 25804800
188154764 Umesh1440 C Jan. 6, 2023, 1:52 a.m. OK Python 3 TESTS 38 935 31232000
188131063 OzodbekX C Jan. 5, 2023, 6 p.m. OK Python 3 TESTS 38 951 21504000
188154297 jaewie C Jan. 6, 2023, 1:39 a.m. OK Python 3 TESTS 38 998 41472000
188160186 chsv183 C Jan. 6, 2023, 3:41 a.m. OK Python 3 TESTS 38 1060 31334400
188136007 deval_100 C Jan. 5, 2023, 6:39 p.m. OK Python 3 TESTS 38 1107 24371200
188129044 arun-mugu C Jan. 5, 2023, 5:47 p.m. OK Python 3 TESTS 38 1122 24064000
188140213 liut C Jan. 5, 2023, 7:32 p.m. OK Rust 2021 TESTS 38 108 12492800
188116816 wmrmr C Jan. 5, 2023, 4:24 p.m. OK Rust 2021 TESTS 36 249 30105600
188143174 variance C Jan. 5, 2023, 8:17 p.m. OK Rust 2021 TESTS 38 264 4608000
188149445 IorMemorE C Jan. 5, 2023, 10:52 p.m. OK Rust 2021 TESTS 38 264 18432000
188150379 IorMemorE C Jan. 5, 2023, 11:26 p.m. OK Rust 2021 TESTS 38 343 18534400

remove filters

Back to search problems