CodeCraft-22 and Codeforces Round 795 (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
1691 CodeCraft-22 and Codeforces Round 795 (Div. 2) FINISHED False 7200 77815499 May 31, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 23493 ) B Shoe Shuffling PROGRAMMING constructive algorithms greedy implementation two pointers

B'A class of students got bored wearing the same pair of shoes every day, so they decided to shuffle their shoes among themselves. In this problem, a pair of shoes is inseparable and is considered as a single object. There are n students in the class, and you are given an array s in non-decreasing order, where s_i is the shoe size of the i -th student. A shuffling of shoes is valid only if no student gets their own shoes and if every student gets shoes of size greater than or equal to their size. You have to output a permutation p of {1,2, ldots,n } denoting a valid shuffling of shoes, where the i -th student gets the shoes of the p_i -th student ( p_i ne i ). And output -1 if a valid shuffling does not exist. A permutation 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). Each test contains multiple test cases. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= q n <= q10^5 ) -- the number of students. The second line of each test case contains n integers s_1, s_2, ldots,s_n ( 1 <= q s_i <= q10^9 , and for all 1 <= i<n , s_i <= s_{i+1} ) -- the shoe sizes of the students. It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, print the answer in a single line using the following format. If a valid shuffling does not exist, print the number -1 as the answer. If a valid shuffling exists, print n space-separated integers -- a permutation p of 1,2, ldots,n denoting a valid shuff'...

Tutorials

Editorial for CodeCraft-22 and Codeforces Round #795 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
159168463 DanielGG B June 1, 2022, 2:01 p.m. OK C# 8 TESTS 30 389 15257600
159152182 siddhu_441 B June 1, 2022, 10:54 a.m. OK GNU C11 TESTS 30 499 409600
159123657 ukuk B June 1, 2022, 5:21 a.m. OK GNU C++14 TESTS 30 46 409600
159189674 zas-lilies B June 1, 2022, 6:13 p.m. OK GNU C++14 TESTS 30 46 409600
159140522 RED_MONK B June 1, 2022, 8:47 a.m. OK GNU C++14 TESTS 30 46 409600
159187060 pazuzu B June 1, 2022, 5:39 p.m. OK GNU C++14 TESTS 30 46 819200
159161089 ahmedabdalsalam157 B June 1, 2022, 12:38 p.m. OK GNU C++14 TESTS 30 46 819200
159157285 WhyWhy B June 1, 2022, 11:53 a.m. OK GNU C++14 TESTS 30 46 819200
159156325 avwl017 B June 1, 2022, 11:42 a.m. OK GNU C++14 TESTS 30 46 819200
159154228 gzchenben B June 1, 2022, 11:18 a.m. OK GNU C++14 TESTS 30 46 819200
159152213 sumit21 B June 1, 2022, 10:54 a.m. OK GNU C++14 TESTS 30 46 819200
159209545 930851771G B June 2, 2022, 3:18 a.m. OK GNU C++14 TESTS 30 46 819200
159134445 KAUSTUBH152003 B June 1, 2022, 7:34 a.m. OK GNU C++17 TESTS 30 46 409600
159129742 chetan.07 B June 1, 2022, 6:38 a.m. OK GNU C++17 TESTS 30 46 409600
159129681 shumu B June 1, 2022, 6:37 a.m. OK GNU C++17 TESTS 30 46 409600
159183967 Red_user B June 1, 2022, 5:02 p.m. OK GNU C++17 TESTS 30 46 409600
159176125 Hawkeye_2000 B June 1, 2022, 3:31 p.m. OK GNU C++17 TESTS 30 46 819200
159163317 Ging_Freecss64 B June 1, 2022, 1:04 p.m. OK GNU C++17 TESTS 30 46 819200
159160547 NasimMahmud B June 1, 2022, 12:32 p.m. OK GNU C++17 TESTS 30 46 819200
159157547 shiv0701 B June 1, 2022, 11:57 a.m. OK GNU C++17 TESTS 30 46 819200
159155289 abc864197532 B June 1, 2022, 11:30 a.m. OK GNU C++17 TESTS 30 46 819200
159197382 Ammar2001 B June 1, 2022, 8:23 p.m. OK GNU C++17 TESTS 30 46 819200
159151582 youtsuha B June 1, 2022, 10:47 a.m. OK GNU C++17 (64) TESTS 30 31 819200
159161052 Gasoline B June 1, 2022, 12:38 p.m. OK GNU C++17 (64) TESTS 30 31 819200
159173328 wcwu B June 1, 2022, 2:56 p.m. OK GNU C++17 (64) TESTS 30 31 1638400
159151108 jason-wang B June 1, 2022, 10:41 a.m. OK GNU C++17 (64) TESTS 30 31 16076800
159176423 vladislav228 B June 1, 2022, 3:34 p.m. OK GNU C++17 (64) TESTS 30 46 409600
159123261 akagodc B June 1, 2022, 5:15 a.m. OK GNU C++17 (64) TESTS 30 46 819200
159138113 siliconoxide4 B June 1, 2022, 8:19 a.m. OK GNU C++17 (64) TESTS 30 46 819200
159173986 rdx_ B June 1, 2022, 3:04 p.m. OK GNU C++17 (64) TESTS 30 46 819200
159162137 Andreasyan B June 1, 2022, 12:51 p.m. OK GNU C++17 (64) TESTS 30 46 921600
159124317 euler1729 B June 1, 2022, 5:30 a.m. OK GNU C++17 (64) TESTS 30 46 921600
159133877 musatur B June 1, 2022, 7:28 a.m. OK GNU C++20 (64) TESTS 30 30 1638400
159130319 linguini_ B June 1, 2022, 6:45 a.m. OK GNU C++20 (64) TESTS 30 31 409600
159176440 VJlinkhero B June 1, 2022, 3:35 p.m. OK GNU C++20 (64) TESTS 30 31 409600
159217499 ccttt B June 2, 2022, 6 a.m. OK GNU C++20 (64) TESTS 30 31 819200
159213189 jieunie B June 2, 2022, 4:46 a.m. OK GNU C++20 (64) TESTS 30 31 819200
159209814 C0ldSmi1e B June 2, 2022, 3:26 a.m. OK GNU C++20 (64) TESTS 30 31 819200
159208922 Sourav___ B June 2, 2022, 3:01 a.m. OK GNU C++20 (64) TESTS 30 31 819200
159204531 SADIQ_insD B June 2, 2022, 12:25 a.m. OK GNU C++20 (64) TESTS 30 31 819200
159204499 SADIQ_insD B June 2, 2022, 12:24 a.m. OK GNU C++20 (64) TESTS 30 31 819200
159197498 Venti_chai B June 1, 2022, 8:26 p.m. OK GNU C++20 (64) TESTS 30 31 819200
159125317 Halix B June 1, 2022, 5:44 a.m. OK Java 11 TESTS 30 202 0
159195042 Minty413 B June 1, 2022, 7:36 p.m. OK Java 11 TESTS 30 218 0
159175524 nawaz_habib B June 1, 2022, 3:24 p.m. OK Java 11 TESTS 30 233 0
159129684 Kaldaruly B June 1, 2022, 6:37 a.m. OK Java 11 TESTS 30 233 0
159129442 amanpatel23 B June 1, 2022, 6:34 a.m. OK Java 11 TESTS 30 234 10240000
159177185 SongXinYang B June 1, 2022, 3:44 p.m. OK Java 11 TESTS 30 248 0
159131182 Kaldaruly B June 1, 2022, 6:55 a.m. OK Java 11 TESTS 30 248 0
159129084 Kaldaruly B June 1, 2022, 6:30 a.m. OK Java 11 TESTS 30 249 409600
159129318 Kaldaruly B June 1, 2022, 6:33 a.m. OK Java 11 TESTS 30 264 0
159209132 Alimineti_Karthikeya B June 2, 2022, 3:07 a.m. OK Java 11 TESTS 30 280 2560000
159136382 ak_ankit B June 1, 2022, 7:59 a.m. OK Java 8 TESTS 30 140 0
159159553 Lucky-Man B June 1, 2022, 12:20 p.m. OK Java 8 TESTS 30 155 0
159142879 UniversalAdmin B June 1, 2022, 9:12 a.m. OK Java 8 TESTS 30 155 0
159137479 zhouzelin B June 1, 2022, 8:11 a.m. OK Java 8 TESTS 30 436 0
159209986 varliu B June 2, 2022, 3:31 a.m. OK Java 8 TESTS 30 592 0
159141414 varliu B June 1, 2022, 8:56 a.m. OK Java 8 TESTS 30 592 0
159137472 ikillmyself B June 1, 2022, 8:11 a.m. OK Java 8 TESTS 30 670 14540800
159167004 wanglujing B June 1, 2022, 1:45 p.m. OK MS C++ 2017 TESTS 30 109 2457600
159196214 Hachapuri B June 1, 2022, 7:58 p.m. OK MS C++ 2017 TESTS 30 140 7987200
159190391 navin_yadav B June 1, 2022, 6:22 p.m. OK MS C++ 2017 TESTS 30 156 3891200
159199044 adesh123 B June 1, 2022, 9:03 p.m. OK MS C++ 2017 TESTS 30 202 5324800
159168807 toxahak B June 1, 2022, 2:04 p.m. OK Node.js TESTS 30 124 18739200
159203965 jscn B June 2, 2022, midnight OK PyPy 3 TESTS 30 249 14745600
159122985 Kishen19 B June 1, 2022, 5:11 a.m. OK PyPy 3 TESTS 30 264 14131200
159175617 rad8928 B June 1, 2022, 3:25 p.m. OK PyPy 3 TESTS 30 373 11673600
159199747 RANK1ZEN B June 1, 2022, 9:22 p.m. OK PyPy 3-64 TESTS 30 124 19558400
159201277 jerwu B June 1, 2022, 10:07 p.m. OK PyPy 3-64 TESTS 30 124 25497600
159153907 tushar26427 B June 1, 2022, 11:14 a.m. OK PyPy 3-64 TESTS 30 202 20684800
159186157 _N_0_0_B_ B June 1, 2022, 5:29 p.m. OK PyPy 3-64 TESTS 30 217 57446400
159123122 KA_Rma B June 1, 2022, 5:13 a.m. OK PyPy 3-64 TESTS 30 280 20582400
159149594 Varad2002 B June 1, 2022, 10:25 a.m. OK PyPy 3-64 TESTS 30 280 21196800
159196094 brimstone B June 1, 2022, 7:56 p.m. OK PyPy 3-64 TESTS 30 280 24268800
159129502 Dhruv_Viradiya B June 1, 2022, 6:35 a.m. OK PyPy 3-64 TESTS 30 296 18944000
159170399 Whichislovely B June 1, 2022, 2:22 p.m. OK PyPy 3-64 TESTS 30 311 20684800
159185848 MashaM B June 1, 2022, 5:25 p.m. OK PyPy 3-64 TESTS 30 311 25804800
159164989 alone__boy B June 1, 2022, 1:23 p.m. OK Python 3 TESTS 30 140 7884800
159175249 STan_Is_LAV B June 1, 2022, 3:20 p.m. OK Python 3 TESTS 30 155 9830400
159166016 2021_01472 B June 1, 2022, 1:34 p.m. OK Python 3 TESTS 30 156 7782400
159136014 hjsky1010 B June 1, 2022, 7:54 a.m. OK Python 3 TESTS 30 171 10444800
159156145 rajesh_455 B June 1, 2022, 11:40 a.m. OK Python 3 TESTS 30 218 9420800
159131320 Tiru_t B June 1, 2022, 6:57 a.m. OK Python 3 TESTS 30 218 12492800
159179358 kondekarshubham123 B June 1, 2022, 4:08 p.m. OK Python 3 TESTS 30 218 14233600
159187829 Ele_1 B June 1, 2022, 5:49 p.m. OK Python 3 TESTS 30 233 7884800
159141283 aniketk28 B June 1, 2022, 8:55 a.m. OK Python 3 TESTS 30 233 7884800
159212853 Nipun_Jugran B June 2, 2022, 4:40 a.m. OK Python 3 TESTS 30 233 8908800
159195367 nktanh B June 1, 2022, 7:42 p.m. OK Rust 2021 TESTS 30 31 8294400
159190660 isaiah_hex B June 1, 2022, 6:26 p.m. OK Rust 2021 TESTS 30 31 8396800

remove filters

Back to search problems