Codeforces Round 1030 (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
2118 Codeforces Round 1030 (Div. 2) FINISHED False 7200 26666723 June 12, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 19946 ) B Make It Permutation PROGRAMMING constructive algorithms

There is a matrix (A) of size (n\times n) where (A_{i,j}=j) for all (1 \le i,j \le n). In one operation, you can select a row and reverse any subarray(^{\text{∗}}) in it. Find a sequence of at most (2n) operations such that every column will contain a permutation(^{\text{†}}) of length (n). It can be proven that the construction is always possible. If there are multiple solutions, output any of them. (^{\text{∗}})An array (a) is a subarray of an array (b) if (a) can be obtained from (b) by deleting zero or more elements from the beginning and zero or more elements from the end. (^{\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). 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 of each test case contains one integer (n) ((3 \le n \le 5000)) — denoting the number of rows and columns in the matrix. It is guaranteed that the sum of (n) over all test cases does not exceed (5000). For each test case, on the first line, print an integer (k) ((0 \le k \le 2n)), the number of operations you wish to perform. On the next lines, you should print the operations. To print an operation, use the format "(i\;l\;r)" ((1 \leq l \leq r \leq n) and (1 \leq i \leq n)) which reverses the subarray (A_{i, l}), (A_{i, l+1}), (\ldots), (A_{i, r}). In the first test case, the following operations are a valid solution:

Tutorials

Codeforces Round 1030 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
324131868 og.kostya B June 12, 2025, 4:28 p.m. OK C# 10 TESTS 5 93 921600
324147508 Kermit. B June 12, 2025, 5:54 p.m. OK C# 10 TESTS 5 93 1638400
324192428 _Equinox B June 13, 2025, 4:56 a.m. OK C# 13 TESTS 5 93 921600
324140807 -firefly- B June 12, 2025, 5:13 p.m. OK C# 13 TESTS 5 93 1638400
324144528 og.kostya B June 12, 2025, 5:34 p.m. OK C# 13 TESTS 5 108 2150400
324148672 Rahma_Elhagary B June 12, 2025, 6:02 p.m. OK C++17 (GCC 7-32) TESTS 5 30 0
324152664 nbreakable B June 12, 2025, 6:33 p.m. OK C++17 (GCC 7-32) TESTS 5 31 0
324185304 1234_5678_9123 B June 13, 2025, 3:30 a.m. OK C++17 (GCC 7-32) TESTS 5 31 0
324148500 Rajeswari_18 B June 12, 2025, 6:01 p.m. OK C++17 (GCC 7-32) TESTS 5 31 0
324150805 Nikhil_Ollala B June 12, 2025, 6:18 p.m. OK C++17 (GCC 7-32) TESTS 5 31 102400
324181488 meetpatel177 B June 13, 2025, 2:36 a.m. OK C++17 (GCC 7-32) TESTS 5 31 102400
324149186 Mossad00 B June 12, 2025, 6:06 p.m. OK C++17 (GCC 7-32) TESTS 5 31 1638400
324198969 Harsh_82_Vardhan B June 13, 2025, 6:01 a.m. OK C++17 (GCC 7-32) TESTS 5 46 0
324199003 Code_Attempt_2 B June 13, 2025, 6:01 a.m. OK C++17 (GCC 7-32) TESTS 5 46 0
324198846 _ryuko B June 13, 2025, 5:59 a.m. OK C++17 (GCC 7-32) TESTS 5 46 0
324185460 darthOverfl0w B June 13, 2025, 3:32 a.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324192449 deekshithkm B June 13, 2025, 4:56 a.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324188365 Lenisel B June 13, 2025, 4:08 a.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324177714 Lonelyper B June 13, 2025, 1:35 a.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324176397 70dwdw B June 13, 2025, 1:09 a.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324174139 zyom B June 13, 2025, 12:16 a.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324171712 Ziad3ssam10 B June 12, 2025, 11:05 p.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324153641 Akarsh_28 B June 12, 2025, 6:43 p.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324151031 xKazimierzx B June 12, 2025, 6:19 p.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324146886 HossamHero7 B June 12, 2025, 5:49 p.m. OK C++20 (GCC 13-64) TESTS 5 31 0
324139455 ICA_677 B June 12, 2025, 5:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 30 0
324191056 saranrs B June 13, 2025, 4:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 5 30 0
324155916 Ldawn_AI B June 12, 2025, 6:53 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 30 0
324173396 user_is_dead B June 12, 2025, 11:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 31 0
324139960 king2008 B June 12, 2025, 5:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 31 0
324136713 byte_shift B June 12, 2025, 4:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 31 0
324133027 saket_kumar_07 B June 12, 2025, 4:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 31 0
324191353 sakuaika B June 13, 2025, 4:45 a.m. OK C++23 (GCC 14-64, msys2) TESTS 5 31 0
324174330 Marckess B June 13, 2025, 12:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 5 31 0
324184433 liuhenggang692562665 B June 13, 2025, 3:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 5 31 102400
324131676 James_bond_9089 B June 12, 2025, 4:27 p.m. OK C# 8 TESTS 5 124 1740800
324155748 ruban B June 12, 2025, 6:51 p.m. OK FPC TESTS 5 93 43417600
324176380 lintttt B June 13, 2025, 1:08 a.m. OK GNU C11 TESTS 5 77 102400
324164210 Manish_5076 B June 12, 2025, 8:31 p.m. OK GNU C11 TESTS 5 77 102400
324157774 Sayantan_Hazra B June 12, 2025, 7:13 p.m. OK GNU C11 TESTS 5 93 102400
324175764 shubhayandas2004 B June 13, 2025, 12:54 a.m. OK GNU C11 TESTS 5 108 0
324150612 treasuryonly B June 12, 2025, 6:17 p.m. OK Haskell TESTS 5 77 0
324142527 Avid.Angler B June 12, 2025, 5:22 p.m. OK Java 21 TESTS 5 218 921600
324148156 jindal2004keshav B June 12, 2025, 5:58 p.m. OK Java 21 TESTS 5 233 819200
324153885 guharoypragyayan B June 12, 2025, 6:45 p.m. OK Java 21 TESTS 5 249 512000
324193402 goalboy B June 13, 2025, 5:05 a.m. OK Java 21 TESTS 5 249 819200
324151819 tekka_ity B June 12, 2025, 6:26 p.m. OK Java 21 TESTS 5 249 921600
324172359 akool B June 12, 2025, 11:24 p.m. OK Java 21 TESTS 5 249 1228800
324139787 Balu2907 B June 12, 2025, 5:09 p.m. OK Java 21 TESTS 5 249 1433600
324191082 marcoJunior B June 13, 2025, 4:42 a.m. OK Java 21 TESTS 5 264 204800
324194495 Ronit0211 B June 13, 2025, 5:16 a.m. OK Java 21 TESTS 5 264 307200
324139915 LeetCodeforces_Null B June 12, 2025, 5:09 p.m. OK Java 21 TESTS 5 264 614400
324198529 sachinbisht2961 B June 13, 2025, 5:56 a.m. OK Java 8 TESTS 5 140 0
324187654 arpande97 B June 13, 2025, 3:59 a.m. OK Java 8 TESTS 5 140 0
324197290 codexzx B June 13, 2025, 5:44 a.m. OK Java 8 TESTS 5 156 0
324186681 bhishma_v2 B June 13, 2025, 3:47 a.m. OK Java 8 TESTS 5 156 0
324186511 deepsalunkhee B June 13, 2025, 3:45 a.m. OK Java 8 TESTS 5 156 0
324187493 anishpati1 B June 13, 2025, 3:56 a.m. OK Java 8 TESTS 5 171 0
324147171 ak47_nitt B June 12, 2025, 5:51 p.m. OK Java 8 TESTS 5 171 0
324178570 prashanth_2327 B June 13, 2025, 1:50 a.m. OK Java 8 TESTS 5 186 0
324153434 not_mohith B June 12, 2025, 6:40 p.m. OK Java 8 TESTS 5 187 0
324148721 gaurimadan002 B June 12, 2025, 6:03 p.m. OK Java 8 TESTS 5 187 0
324153782 Seif_Shaheen B June 12, 2025, 6:44 p.m. OK Kotlin 1.9 TESTS 5 171 0
324147963 AnatolyS B June 12, 2025, 5:57 p.m. OK Kotlin 1.9 TESTS 5 171 0
324153284 L-S-S B June 12, 2025, 6:39 p.m. OK Kotlin 1.9 TESTS 5 186 0
324184097 cminder B June 13, 2025, 3:12 a.m. OK PyPy 3 TESTS 5 140 69017600
324132938 prudentissimus B June 12, 2025, 4:29 p.m. OK PyPy 3 TESTS 5 156 4915200
324134077 ashrith.07 B June 12, 2025, 4:31 p.m. OK PyPy 3 TESTS 5 156 5632000
324166770 Mr.Beast192 B June 12, 2025, 9:11 p.m. OK PyPy 3 TESTS 5 156 6348800
324131876 kevin_kaslanna B June 12, 2025, 4:28 p.m. OK PyPy 3 TESTS 5 171 6246400
324132073 xingguang641 B June 12, 2025, 4:28 p.m. OK PyPy 3 TESTS 5 187 5939200
324146448 DSKroc B June 12, 2025, 5:46 p.m. OK PyPy 3 TESTS 5 249 9728000
324152609 coder.sy B June 12, 2025, 6:32 p.m. OK PyPy 3 TESTS 5 311 115814400
324163000 gardengnome B June 12, 2025, 8:17 p.m. OK PyPy 3-64 TESTS 5 93 2867200
324189560 akkisinghvi28 B June 13, 2025, 4:24 a.m. OK PyPy 3-64 TESTS 5 93 3379200
324190180 K_alpha-genZ B June 13, 2025, 4:32 a.m. OK PyPy 3-64 TESTS 5 93 3584000
324177517 taowdy B June 13, 2025, 1:32 a.m. OK PyPy 3-64 TESTS 5 93 3993600
324182360 huangjiajing B June 13, 2025, 2:47 a.m. OK PyPy 3-64 TESTS 5 93 4198400
324177971 KuDikan B June 13, 2025, 1:40 a.m. OK PyPy 3-64 TESTS 5 93 5222400
324175776 stalgatuly B June 13, 2025, 12:55 a.m. OK PyPy 3-64 TESTS 5 93 5324800
324133344 pspkmahali B June 12, 2025, 4:30 p.m. OK PyPy 3-64 TESTS 5 108 3072000
324155829 Harshal_Kanani B June 12, 2025, 6:52 p.m. OK PyPy 3-64 TESTS 5 108 3788800
324144204 arashnm80 B June 12, 2025, 5:32 p.m. OK PyPy 3-64 TESTS 5 108 4198400
324185085 svrmalaviya B June 13, 2025, 3:27 a.m. OK Python 3 TESTS 5 62 409600
324183749 titi_zzz B June 13, 2025, 3:08 a.m. OK Python 3 TESTS 5 77 409600
324160002 tanvirmahfuz22 B June 12, 2025, 7:39 p.m. OK Python 3 TESTS 5 77 409600
324153683 ashvathhb B June 12, 2025, 6:43 p.m. OK Python 3 TESTS 5 77 409600
324167973 pplodev B June 12, 2025, 9:32 p.m. OK Python 3 TESTS 5 77 512000
324157791 govind53 B June 12, 2025, 7:13 p.m. OK Python 3 TESTS 5 77 1433600
324175962 cmath11 B June 13, 2025, 12:59 a.m. OK Python 3 TESTS 5 77 1536000
324175446 Sovietguard2050 B June 13, 2025, 12:46 a.m. OK Python 3 TESTS 5 77 1536000
324136102 yaswanthsanju B June 12, 2025, 4:34 p.m. OK Python 3 TESTS 5 77 1536000
324134794 maaya2526 B June 12, 2025, 4:32 p.m. OK Python 3 TESTS 5 77 2662400
324184566 BetterThanNobita B June 13, 2025, 3:19 a.m. OK Rust 2021 TESTS 5 46 102400
324144623 sousou_no_frieren B June 12, 2025, 5:35 p.m. OK Rust 2021 TESTS 5 77 0

remove filters

Back to search problems