Codeforces Round 1051 (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
2143 Codeforces Round 1051 (Div. 2) FINISHED False 7200 18285923 Sept. 17, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 20620 ) A All Lengths Subtraction PROGRAMMING two pointers

You are given a permutation(^{\text{∗}}) (p) of length (n). You must perform exactly one operation for each integer (k) from 1 up to (n) in that order: Choose a subarray(^{\text{†}}) of (p) of length exactly (k), and subtract 1 from every element in that subarray. After completing all (n) operations, your goal is to have all elements of the array equal to zero. Determine whether it is possible to achieve this. (^{\text{∗}})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). (^{\text{†}})An array (a) is a subarray of an array (b) if (a) can be obtained from (b) by the deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 100)). The description of the test cases follows. The first line contains the value (n) ((1 \leq n \leq 100)) — the length of the permutation. The second line contains (p_1, p_2, \ldots p_n) ((1 \le p_i \le n)) — the permutation itself. For each test case, output YES if it is possible to make all elements of the array (p) equal to (0) after performing all the operations; otherwise, output NO . You can output the answer in any case (upper or lower). For example, the strings " yEs ", " yes ", " Yes ", and " YES " will be recognized as positive responses. For the first test case, we can proceed as follows: (k = 1): Choose the subarray (3, 3). The array (1, 3, 4, 2) becomes (1, 3, 3, 2). (k = 2): Choose the subarray (2, 3). The array (1, 3, 3, 2) be

Tutorials

Codeforces Round 1051 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
339144151 lamboktulus1379 A Sept. 17, 2025, 4:03 p.m. OK C# 13 TESTS 4 108 409600
339173558 ireallydontknow A Sept. 17, 2025, 7:10 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
339162138 ImaginedTime A Sept. 17, 2025, 5:33 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
339147711 Mr.RAT A Sept. 17, 2025, 4:12 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
339202859 sakshi6686 A Sept. 18, 2025, 4:31 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
339191270 _vasu491_ A Sept. 18, 2025, 1:28 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
339205479 Prabassn A Sept. 18, 2025, 5:14 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
339209041 karansinghshekhawat2110 A Sept. 18, 2025, 5:57 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
339206245 abhi_8923 A Sept. 18, 2025, 5:24 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
339206176 Satyanshu111 A Sept. 18, 2025, 5:23 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
339205933 lgzbgz A Sept. 18, 2025, 5:21 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
339206937 azadsinghdinkar_965 A Sept. 18, 2025, 5:33 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
339205498 harsh007_ A Sept. 18, 2025, 5:15 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
339196414 A1_hyperion A Sept. 18, 2025, 2:51 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
339191955 eatyumi A Sept. 18, 2025, 1:42 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
339190449 carlosgaelhp A Sept. 18, 2025, 1:09 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
339188240 ylb_Ac2003 A Sept. 18, 2025, 12:17 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
339185295 MohZoro A Sept. 17, 2025, 10:53 p.m. OK C++20 (GCC 13-64) TESTS 4 30 0
339161691 PM_Brijesh A Sept. 17, 2025, 5:31 p.m. OK C++20 (GCC 13-64) TESTS 4 30 0
339161517 Ziad3ssam10 A Sept. 17, 2025, 5:29 p.m. OK C++20 (GCC 13-64) TESTS 4 30 0
339197150 HazeraRitu A Sept. 18, 2025, 3 a.m. OK C++20 (GCC 13-64) TESTS 4 30 80179200
339188420 2300770025 A Sept. 18, 2025, 12:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
339193545 YFffffffff A Sept. 18, 2025, 2:08 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
339206493 Rashed_Raiyan_ A Sept. 18, 2025, 5:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
339205847 chinmay_12 A Sept. 18, 2025, 5:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
339204081 molongdadi A Sept. 18, 2025, 4:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
339201263 capable_average A Sept. 18, 2025, 4:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
339200698 t_time A Sept. 18, 2025, 3:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
339197967 edo06 A Sept. 18, 2025, 3:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
339197783 __90m3 A Sept. 18, 2025, 3:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
339193577 B_Arun_T A Sept. 18, 2025, 2:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
339145453 Scarlet_speedster A Sept. 17, 2025, 4:06 p.m. OK GNU C11 TESTS 4 15 0
339154479 sunfatgh A Sept. 17, 2025, 4:31 p.m. OK GNU C11 TESTS 4 30 0
339201481 SebAriel A Sept. 18, 2025, 4:05 a.m. OK GNU C11 TESTS 4 30 102400
339142888 NoshikSai_2902 A Sept. 17, 2025, 3:59 p.m. OK GNU C11 TESTS 4 31 0
339161814 foxxie.softpaws A Sept. 17, 2025, 5:31 p.m. OK GNU C11 TESTS 4 31 0
339160314 Warrior66766 A Sept. 17, 2025, 5:23 p.m. OK GNU C11 TESTS 4 31 0
339143359 santoshsreekarbhandaru7 A Sept. 17, 2025, 4:01 p.m. OK GNU C11 TESTS 4 31 0
339186465 tejazzz A Sept. 17, 2025, 11:28 p.m. OK GNU C11 TESTS 4 31 102400
339198207 love_gold_ A Sept. 18, 2025, 3:14 a.m. OK GNU C11 TESTS 4 31 102400
339167922 ChiragBH_07 A Sept. 17, 2025, 6:14 p.m. OK GNU C11 TESTS 4 46 0
339143471 inblank A Sept. 17, 2025, 4:01 p.m. OK Go TESTS 4 46 307200
339181769 dj.motupalli A Sept. 17, 2025, 9:16 p.m. OK Java 21 TESTS 4 187 614400
339156265 abhinavs1920s A Sept. 17, 2025, 4:34 p.m. OK Java 21 TESTS 4 202 0
339203529 tekka_ity A Sept. 18, 2025, 4:44 a.m. OK Java 21 TESTS 4 202 0
339200155 divyanshnm A Sept. 18, 2025, 3:41 a.m. OK Java 21 TESTS 4 202 0
339164178 kaggggg A Sept. 17, 2025, 5:47 p.m. OK Java 21 TESTS 4 202 102400
339201725 srprawinraja A Sept. 18, 2025, 4:09 a.m. OK Java 21 TESTS 4 202 307200
339144565 apchampion12 A Sept. 17, 2025, 4:04 p.m. OK Java 21 TESTS 4 202 512000
339148665 rithviksopinti A Sept. 17, 2025, 4:15 p.m. OK Java 21 TESTS 4 217 307200
339161805 ajikhoji A Sept. 17, 2025, 5:31 p.m. OK Java 21 TESTS 4 218 204800
339153163 daulat_309 A Sept. 17, 2025, 4:27 p.m. OK Java 21 TESTS 4 218 204800
339165158 sarthaKKharKa_18 A Sept. 17, 2025, 5:53 p.m. OK Java 8 TESTS 4 155 0
339164368 Hussein_Shahbandar A Sept. 17, 2025, 5:48 p.m. OK Java 8 TESTS 4 155 0
339154034 Ffrazi A Sept. 17, 2025, 4:29 p.m. OK Java 8 TESTS 4 155 0
339192693 Michael180 A Sept. 18, 2025, 1:51 a.m. OK Java 8 TESTS 4 155 0
339151968 nsairekha A Sept. 17, 2025, 4:24 p.m. OK Java 8 TESTS 4 155 0
339177350 Shafat04 A Sept. 17, 2025, 8 p.m. OK Java 8 TESTS 4 156 0
339147791 Coder_2345 A Sept. 17, 2025, 4:12 p.m. OK Java 8 TESTS 4 156 0
339169779 ujwalcoderhunter A Sept. 17, 2025, 6:30 p.m. OK Java 8 TESTS 4 171 0
339208834 BliZZardPirO A Sept. 18, 2025, 5:55 a.m. OK Java 8 TESTS 4 171 0
339161776 rathodved007 A Sept. 17, 2025, 5:31 p.m. OK Java 8 TESTS 4 171 0
339168013 hadibd A Sept. 17, 2025, 6:15 p.m. OK Kotlin 2.2 TESTS 4 140 102400
339167655 hadibd A Sept. 17, 2025, 6:12 p.m. OK Kotlin 2.2 TESTS 4 218 0
339176919 swseverance A Sept. 17, 2025, 7:54 p.m. OK Node.js TESTS 4 92 2150400
339163130 profenc1ng A Sept. 17, 2025, 5:40 p.m. OK PyPy 2 TESTS 4 108 512000
339149733 Cyros A Sept. 17, 2025, 4:18 p.m. OK PyPy 2 TESTS 4 109 307200
339203871 CODING-- A Sept. 18, 2025, 4:49 a.m. OK PyPy 2 TESTS 4 156 409600
339142747 sohamgupta.1515 A Sept. 17, 2025, 3:59 p.m. OK PyPy 3 TESTS 4 92 1433600
339180403 StupidGuy13 A Sept. 17, 2025, 8:49 p.m. OK PyPy 3 TESTS 4 93 1433600
339146725 Dangerous_Coder_69 A Sept. 17, 2025, 4:10 p.m. OK PyPy 3 TESTS 4 93 1945600
339163929 Dimka_selvan A Sept. 17, 2025, 5:45 p.m. OK PyPy 3 TESTS 4 108 1433600
339142615 utsab77 A Sept. 17, 2025, 3:59 p.m. OK PyPy 3 TESTS 4 109 1843200
339208653 kaedeeeee A Sept. 18, 2025, 5:53 a.m. OK PyPy 3 TESTS 4 109 2355200
339162193 jsaddict044 A Sept. 17, 2025, 5:33 p.m. OK PyPy 3 TESTS 4 124 2150400
339166972 hasangiyosov603 A Sept. 17, 2025, 6:07 p.m. OK PyPy 3 TESTS 4 140 2764800
339203120 _PD_ A Sept. 18, 2025, 4:36 a.m. OK PyPy 3 TESTS 4 187 4403200
339163204 explainer A Sept. 17, 2025, 5:40 p.m. OK PyPy 3-64 TESTS 4 62 1433600
339172980 mega_bot A Sept. 17, 2025, 7:03 p.m. OK PyPy 3-64 TESTS 4 77 1433600
339164600 ashvanthvijai2007 A Sept. 17, 2025, 5:49 p.m. OK PyPy 3-64 TESTS 4 77 1433600
339166701 shreyy57890 A Sept. 17, 2025, 6:05 p.m. OK PyPy 3-64 TESTS 4 77 1433600
339202340 Deven_00 A Sept. 18, 2025, 4:21 a.m. OK PyPy 3-64 TESTS 4 77 1433600
339201696 gardengnome A Sept. 18, 2025, 4:08 a.m. OK PyPy 3-64 TESTS 4 77 1433600
339197664 bebopboi A Sept. 18, 2025, 3:08 a.m. OK PyPy 3-64 TESTS 4 77 1536000
339198819 TTO76 A Sept. 18, 2025, 3:22 a.m. OK PyPy 3-64 TESTS 4 77 1536000
339198604 TTO76 A Sept. 18, 2025, 3:19 a.m. OK PyPy 3-64 TESTS 4 77 1536000
339198239 TTO76 A Sept. 18, 2025, 3:14 a.m. OK PyPy 3-64 TESTS 4 77 1536000
339162504 durveshgangan28062005 A Sept. 17, 2025, 5:36 p.m. OK Python 3 TESTS 4 46 0
339179903 dominica89231 A Sept. 17, 2025, 8:41 p.m. OK Python 3 TESTS 4 61 0
339153228 Adilet_Azo A Sept. 17, 2025, 4:27 p.m. OK Python 3 TESTS 4 61 0
339146759 23R01A05BM A Sept. 17, 2025, 4:10 p.m. OK Python 3 TESTS 4 61 0
339198748 need_thing A Sept. 18, 2025, 3:21 a.m. OK Python 3 TESTS 4 61 102400
339207737 ashwanthkumar83 A Sept. 18, 2025, 5:43 a.m. OK Python 3 TESTS 4 62 0
339205239 vidhusan17 A Sept. 18, 2025, 5:11 a.m. OK Python 3 TESTS 4 62 0
339200446 HungJry A Sept. 18, 2025, 3:46 a.m. OK Python 3 TESTS 4 62 0
339166236 Di_Lorenzo. A Sept. 17, 2025, 6:01 p.m. OK Python 3 TESTS 4 62 0
339153927 Deep2025 A Sept. 17, 2025, 4:29 p.m. OK Python 3 TESTS 4 62 0
339148144 rejoansardar876 A Sept. 17, 2025, 4:14 p.m. OK Rust 2021 TESTS 4 61 0
339142852 Ikari_Shinji A Sept. 17, 2025, 3:59 p.m. OK Rust 2024 TESTS 4 31 0
339143796 AnuragYADAV_10 A Sept. 17, 2025, 4:02 p.m. OK Rust 2024 TESTS 4 62 0

remove filters

Back to search problems