Nebius Round 2 (Codeforces Round 1088, Div. 1 + 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
2211 Nebius Round 2 (Codeforces Round 1088, Div. 1 + Div. 2) FINISHED False 9000 1696523 March 28, 2026, 2:45 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 3481 ) C2 Equal Multisets (Hard Version) PROGRAMMING greedy

This is the hard version of the problem. The difference between the versions is that in this version, the array (a) is arbitrary. You can hack only if you solved all versions of this problem. Given an array (a) of size (n), and a parameter (k), an array (b) is called cool if the following conditions hold: For each (i) from (k) to (n), the array (a_{i-k+1},a_{i-k+2},\ldots,a_i) is a rearrangement of (b_{i-k+1},b_{i-k+2},\ldots,b_i). You are given two arrays (a) and (b) of size (n), and an integer (k). The array (a) only contains integers from (1) to (n). The array (b) only contains integers from (1) to (n), and (-1). Determine if it is possible to replace all (-1) in (b) with an integer from (1) to (n), such that (b) is cool with respect to (k). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n) and (k) ((1 \leq k \leq n \leq 2\cdot 10^5)). The second line of each test case contains (n) integers (a_1,a_2,\ldots,a_n) ((1 \leq a_i \leq n)). The third line of each test case contains (n) integers (b_1,b_2,\ldots,b_n) ((1 \leq b_i \leq n) or (b_i=-1)). It is guaranteed that the sum of (n) across all test cases does not exceed (2\cdot 10^5). For each test case, output YES if possible, and NO otherwise. You may print each letter in either uppercase or lowercase. In the first test case, we have (k=5). The only subarray of size (5) is (1,5). We can see that (b) is a rearrangement of (a), so the answer is YES . In the second test case, we can have (b=2,1,2,1,2). We can see that each window of size (2) in both (a) and (b) are either (1,2) or (2,1), which are rearrangements of each other, s

Tutorials

Nebius Round 2 and Codeforces Round 1088 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
368590486 LiQiu_Quu C2 March 28, 2026, 5 p.m. OK C++17 (GCC 7-32) TESTS 20 46 4300800
368614658 Shash__wat C2 March 28, 2026, 10:39 p.m. OK C++17 (GCC 7-32) TESTS 20 93 102400
368592105 Shiroha_Naruse C2 March 28, 2026, 5:05 p.m. OK C++17 (GCC 7-32) TESTS 20 109 0
368626935 AC_Quan C2 March 29, 2026, 4:24 a.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
368609791 marcogambaro C2 March 28, 2026, 8:41 p.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
368608598 _Jeweler C2 March 28, 2026, 8:19 p.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
368606886 abhishek23102 C2 March 28, 2026, 7:53 p.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
368594921 Labib_Morol C2 March 28, 2026, 5:14 p.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
368592966 tav.tuananh C2 March 28, 2026, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
368592889 TavenDo C2 March 28, 2026, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
368633703 theRealChainman C2 March 29, 2026, 5:53 a.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368627767 iyu0 C2 March 29, 2026, 4:39 a.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368625725 Gemini3.1Pro C2 March 29, 2026, 4:01 a.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368623838 Weobe C2 March 29, 2026, 3:24 a.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368621736 Enti C2 March 29, 2026, 2:35 a.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368621116 Gemini3.1Pro C2 March 29, 2026, 2:21 a.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368620004 Gemini3.1Pro C2 March 29, 2026, 1:51 a.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368593968 Harsh_Chavda C2 March 28, 2026, 5:11 p.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368587346 i_love_tree C2 March 28, 2026, 4:50 p.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368586848 Mehul_05 C2 March 28, 2026, 4:48 p.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
368630655 singh_rocks101 C2 March 29, 2026, 5:19 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368630456 33550336 C2 March 29, 2026, 5:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368629320 RuchirSharma038 C2 March 29, 2026, 5:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368617811 yuugureyuu C2 March 29, 2026, 12:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368617246 I_am_blindfold C2 March 29, 2026, 12:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368614733 farica C2 March 28, 2026, 10:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368614360 njnjn75 C2 March 28, 2026, 10:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368613334 Rahul C2 March 28, 2026, 9:59 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368607370 OxyaneOH2 C2 March 28, 2026, 8 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368605488 abhikr03 C2 March 28, 2026, 7:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 102400
368587529 actualtsg C2 March 28, 2026, 4:50 p.m. OK GNU C11 TESTS 20 78 2662400
368585989 waitxlight C2 March 28, 2026, 4:46 p.m. OK Java 21 TESTS 20 250 102400
368621124 InvariantCut C2 March 29, 2026, 2:21 a.m. OK Java 21 TESTS 20 250 819200
368581467 jaysuryaray1998 C2 March 28, 2026, 4:33 p.m. OK Java 21 TESTS 20 281 3891200
368582174 abhaykr1232 C2 March 28, 2026, 4:35 p.m. OK Java 21 TESTS 20 296 1228800
368614591 saanikaa C2 March 28, 2026, 10:36 p.m. OK Java 21 TESTS 20 312 3481600
368592179 saptakmondal734 C2 March 28, 2026, 5:06 p.m. OK Java 21 TESTS 20 328 3891200
368590389 NobelPrizeIsMine C2 March 28, 2026, 5 p.m. OK Java 21 TESTS 20 343 7987200
368591958 2320030082 C2 March 28, 2026, 5:05 p.m. OK Java 21 TESTS 20 359 16896000
368591800 manishb666 C2 March 28, 2026, 5:04 p.m. OK Java 21 TESTS 20 359 16896000
368592286 BiggestFish06 C2 March 28, 2026, 5:06 p.m. OK Java 21 TESTS 20 406 6656000
368592342 CodeLover2007 C2 March 28, 2026, 5:06 p.m. OK Java 8 TESTS 20 187 0
368586409 malachi_toney_goat C2 March 28, 2026, 4:47 p.m. OK Java 8 TESTS 20 203 4505600
368589481 ousben63 C2 March 28, 2026, 4:56 p.m. OK Java 8 TESTS 20 234 5120000
368588507 nirbhaysora C2 March 28, 2026, 4:53 p.m. OK PyPy 3 TESTS 20 515 26112000
368592844 knightik C2 March 28, 2026, 5:08 p.m. OK PyPy 3 TESTS 20 578 25600000
368587608 pseudo404 C2 March 28, 2026, 4:51 p.m. OK PyPy 3 TESTS 20 640 20480000
368615662 dzqdzqdqddq C2 March 28, 2026, 11:12 p.m. OK PyPy 3-64 TESTS 20 187 28672000
368601954 OAY71011 C2 March 28, 2026, 6:52 p.m. OK PyPy 3-64 TESTS 20 187 29388800
368583168 fakeman55555 C2 March 28, 2026, 4:38 p.m. OK PyPy 3-64 TESTS 20 187 29388800
368605954 akane646 C2 March 28, 2026, 7:39 p.m. OK PyPy 3-64 TESTS 20 187 32563200
368630556 Pat4onus2003 C2 March 29, 2026, 5:18 a.m. OK PyPy 3-64 TESTS 20 187 54579200
368585094 ninzasoni C2 March 28, 2026, 4:43 p.m. OK PyPy 3-64 TESTS 20 218 33382400
368589916 Sheikah C2 March 28, 2026, 4:58 p.m. OK PyPy 3-64 TESTS 20 218 33996800
368634625 Akshar_7 C2 March 29, 2026, 6:01 a.m. OK PyPy 3-64 TESTS 20 234 25600000
368613475 weii2000 C2 March 28, 2026, 10:03 p.m. OK PyPy 3-64 TESTS 20 250 36556800
368612489 DeadMan69 C2 March 28, 2026, 9:37 p.m. OK PyPy 3-64 TESTS 20 250 51507200
368592533 Jimanbanashi C2 March 28, 2026, 5:07 p.m. OK Python 2 TESTS 20 296 14438400
368582429 final3blindside C2 March 28, 2026, 4:35 p.m. OK Python 3 TESTS 20 390 35532800
368592081 rajnisihsingh07 C2 March 28, 2026, 5:05 p.m. OK Python 3 TESTS 20 437 73728000
368582726 vkrockerz C2 March 28, 2026, 4:36 p.m. OK Python 3 TESTS 20 515 32972800
368592172 vimo9900 C2 March 28, 2026, 5:06 p.m. OK Python 3 TESTS 20 640 93286400
368595117 Seroluce C2 March 28, 2026, 5:14 p.m. OK Rust 2024 TESTS 20 78 21401600
368618364 _JG_ C2 March 29, 2026, 12:58 a.m. OK Rust 2024 TESTS 20 125 12492800

remove filters

Back to search problems