Codeforces Round 1077 (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
2188 Codeforces Round 1077 (Div. 2) FINISHED False 10800 6708323 Jan. 29, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 25705 ) A Divisible Permutation PROGRAMMING constructive algorithms

You are given an integer (n). Construct a permutation(^{\text{∗}}) (p) of length (n) satisfying the following condition: (\lvert p_i - p_{i+1} \rvert) is divisible by (i) for every (1 \le i \le n-1). It can be proven that such a permutation always exists under the constraints of the problem. (^{\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 only line of each test case contains a single integer (n) ((2 \le n \le 100)) — the length of the permutation (p) to be constructed. For each test case, output (n) integers (p_1,p_2,\ldots,p_n) ((1 \le p_i \le n), all (p_i)-s are distinct) — the permutation you constructed. If there are multiple valid permutations, you may output any of them. In the first test case, (p=1,2) satisfies the condition because (\lvert p_1-p_2\rvert=\lvert 1-2\rvert=1), which is divisible by (1). In the second test case, (p=2,3,1) satisfies the condition because: (\lvert p_1-p_2\rvert=\lvert 2-3\rvert=1), which is divisible by (1), and (\lvert p_2-p_3\rvert=\lvert 3-1\rvert=2), which is divisible by (2).

Tutorials

Codeforces Round 1077 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
360647191 nksammirPL A Jan. 30, 2026, 12:01 a.m. OK C# 13 TESTS 3 62 3788800
360669998 poijjk--0 A Jan. 30, 2026, 6:04 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360667084 yashpatel4239 A Jan. 30, 2026, 5:40 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360666962 Its_ankit_06 A Jan. 30, 2026, 5:39 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360666272 anishgupta99 A Jan. 30, 2026, 5:33 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360664558 silentshouter A Jan. 30, 2026, 5:18 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360664307 DodoAmi A Jan. 30, 2026, 5:15 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360664027 SK_SHANIF A Jan. 30, 2026, 5:13 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360663561 soham__262006 A Jan. 30, 2026, 5:09 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360663332 sk__18 A Jan. 30, 2026, 5:06 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360662893 TCrB_yzc A Jan. 30, 2026, 5:02 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
360648809 yyy__empty A Jan. 30, 2026, 12:58 a.m. OK C++20 (GCC 13-64) TESTS 3 0 0
360668004 _hskad_ A Jan. 30, 2026, 5:48 a.m. OK C++20 (GCC 13-64) TESTS 3 15 0
360670261 x522795 A Jan. 30, 2026, 6:06 a.m. OK C++20 (GCC 13-64) TESTS 3 15 0
360668668 RojoBits A Jan. 30, 2026, 5:54 a.m. OK C++20 (GCC 13-64) TESTS 3 15 0
360668101 HXYDSG A Jan. 30, 2026, 5:49 a.m. OK C++20 (GCC 13-64) TESTS 3 15 0
360667942 HXYDSG A Jan. 30, 2026, 5:47 a.m. OK C++20 (GCC 13-64) TESTS 3 15 0
360666310 tejaspb8 A Jan. 30, 2026, 5:34 a.m. OK C++20 (GCC 13-64) TESTS 3 15 0
360664353 lakshya072008 A Jan. 30, 2026, 5:16 a.m. OK C++20 (GCC 13-64) TESTS 3 15 0
360662432 Bhanu_practice A Jan. 30, 2026, 4:58 a.m. OK C++20 (GCC 13-64) TESTS 3 15 0
360660930 devang19 A Jan. 30, 2026, 4:44 a.m. OK C++20 (GCC 13-64) TESTS 3 15 0
360666863 foolingaround A Jan. 30, 2026, 5:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360665724 retard__ A Jan. 30, 2026, 5:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360670208 gt99 A Jan. 30, 2026, 6:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360669691 litachloveyou A Jan. 30, 2026, 6:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360669528 UnpairedNur008 A Jan. 30, 2026, 6:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360669334 manikgupta2k04 A Jan. 30, 2026, 5:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360668980 j.e14 A Jan. 30, 2026, 5:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360668845 anish91620 A Jan. 30, 2026, 5:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360667382 codemaxxer4246 A Jan. 30, 2026, 5:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360666944 alpha_5227 A Jan. 30, 2026, 5:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
360631955 MirazHossain_ A Jan. 29, 2026, 7:50 p.m. OK C# 8 TESTS 3 125 716800
360628856 dev149 A Jan. 29, 2026, 7:21 p.m. OK GNU C11 TESTS 3 31 0
360649899 setsunovo A Jan. 30, 2026, 1:26 a.m. OK GNU C11 TESTS 3 31 0
360613939 fuad_01123 A Jan. 29, 2026, 5:30 p.m. OK GNU C11 TESTS 3 31 0
360627623 johnthedon_12 A Jan. 29, 2026, 7:10 p.m. OK GNU C11 TESTS 3 46 0
360649216 hellodairy1 A Jan. 30, 2026, 1:09 a.m. OK GNU C11 TESTS 3 46 0
360603093 pardhuyerrolla A Jan. 29, 2026, 5:01 p.m. OK GNU C11 TESTS 3 46 0
360613000 Soham0407 A Jan. 29, 2026, 5:27 p.m. OK GNU C11 TESTS 3 46 0
360605608 pannu_16 A Jan. 29, 2026, 5:07 p.m. OK GNU C11 TESTS 3 78 102400
360621097 peraka A Jan. 29, 2026, 6:22 p.m. OK GNU C11 TESTS 3 109 0
360639789 Yahalosse A Jan. 29, 2026, 9:26 p.m. OK Go TESTS 3 15 102400
360669187 keshav_.agg A Jan. 30, 2026, 5:58 a.m. OK Java 21 TESTS 3 125 614400
360645128 sathwikhbhat A Jan. 29, 2026, 11:10 p.m. OK Java 21 TESTS 3 125 614400
360604518 YONEXHERO A Jan. 29, 2026, 5:04 p.m. OK Java 21 TESTS 3 171 0
360635213 NooB__C0der A Jan. 29, 2026, 8:26 p.m. OK Java 21 TESTS 3 171 512000
360603558 dhananjaykr70556 A Jan. 29, 2026, 5:02 p.m. OK Java 21 TESTS 3 171 512000
360658914 PecManO2 A Jan. 30, 2026, 4:18 a.m. OK Java 21 TESTS 3 171 716800
360627056 princekohli3621 A Jan. 29, 2026, 7:05 p.m. OK Java 21 TESTS 3 171 1843200
360620311 gunjank775 A Jan. 29, 2026, 6:17 p.m. OK Java 21 TESTS 3 187 204800
360647858 Nitesh_003 A Jan. 30, 2026, 12:26 a.m. OK Java 21 TESTS 3 187 307200
360669993 sakshams7778 A Jan. 30, 2026, 6:04 a.m. OK Java 21 TESTS 3 187 307200
360655012 SivaPA A Jan. 30, 2026, 3:16 a.m. OK Java 8 TESTS 3 93 0
360649008 NeelmaniPandey09 A Jan. 30, 2026, 1:03 a.m. OK Java 8 TESTS 3 109 0
360659097 javeed_123 A Jan. 30, 2026, 4:20 a.m. OK Java 8 TESTS 3 109 0
360627386 d1n0Codes A Jan. 29, 2026, 7:07 p.m. OK Java 8 TESTS 3 109 0
360621413 naveennagar9617 A Jan. 29, 2026, 6:24 p.m. OK Java 8 TESTS 3 125 0
360626026 leo_mohan A Jan. 29, 2026, 6:56 p.m. OK Java 8 TESTS 3 125 0
360603283 nandhika66 A Jan. 29, 2026, 5:01 p.m. OK Java 8 TESTS 3 125 0
360621673 breshma0805 A Jan. 29, 2026, 6:25 p.m. OK Java 8 TESTS 3 140 0
360655317 rohit234 A Jan. 30, 2026, 3:21 a.m. OK Java 8 TESTS 3 140 0
360610796 tejasree20 A Jan. 29, 2026, 5:21 p.m. OK Java 8 TESTS 3 140 0
360668406 Deathbycode7 A Jan. 30, 2026, 5:52 a.m. OK PyPy 3 TESTS 3 62 1433600
360659245 rishivinu4u A Jan. 30, 2026, 4:22 a.m. OK PyPy 3 TESTS 3 62 2560000
360642048 joker_1394 A Jan. 29, 2026, 10:06 p.m. OK PyPy 3 TESTS 3 78 2662400
360604614 Yj29 A Jan. 29, 2026, 5:05 p.m. OK PyPy 3 TESTS 3 109 1945600
360632496 arob9291 A Jan. 29, 2026, 7:56 p.m. OK PyPy 3-64 TESTS 3 31 1945600
360660178 freakbuoyancy A Jan. 30, 2026, 4:35 a.m. OK PyPy 3-64 TESTS 3 31 2048000
360635171 WentaoChen A Jan. 29, 2026, 8:26 p.m. OK PyPy 3-64 TESTS 3 46 1433600
360627499 HummingNerd A Jan. 29, 2026, 7:08 p.m. OK PyPy 3-64 TESTS 3 46 1433600
360651772 nano_nanoo A Jan. 30, 2026, 2:12 a.m. OK PyPy 3-64 TESTS 3 46 1536000
360621276 krishna369 A Jan. 29, 2026, 6:23 p.m. OK PyPy 3-64 TESTS 3 46 1945600
360654832 svrmalaviya A Jan. 30, 2026, 3:12 a.m. OK PyPy 3-64 TESTS 3 46 2048000
360650976 xing_he A Jan. 30, 2026, 1:54 a.m. OK PyPy 3-64 TESTS 3 46 2048000
360650417 Zeeshan-Haider-Alvi A Jan. 30, 2026, 1:41 a.m. OK PyPy 3-64 TESTS 3 46 2048000
360613740 FuriousSnail A Jan. 29, 2026, 5:29 p.m. OK PyPy 3-64 TESTS 3 46 2048000
360654975 snailG A Jan. 30, 2026, 3:15 a.m. OK Python 3 TESTS 3 31 0
360651186 sightf123 A Jan. 30, 2026, 1:59 a.m. OK Python 3 TESTS 3 31 0
360641753 DarkNight47Rises A Jan. 29, 2026, 10 p.m. OK Python 3 TESTS 3 31 0
360628783 sagar_mesara A Jan. 29, 2026, 7:20 p.m. OK Python 3 TESTS 3 31 0
360605499 durga0103 A Jan. 29, 2026, 5:07 p.m. OK Python 3 TESTS 3 31 0
360629612 Bhavishya_Jhamb A Jan. 29, 2026, 7:28 p.m. OK Python 3 TESTS 3 31 102400
360607207 anugnapatha2007 A Jan. 29, 2026, 5:11 p.m. OK Python 3 TESTS 3 31 102400
360659238 Harsh__Patel A Jan. 30, 2026, 4:22 a.m. OK Python 3 TESTS 3 46 0
360658247 mahfuz-prog A Jan. 30, 2026, 4:07 a.m. OK Python 3 TESTS 3 46 0
360625063 swarup007 A Jan. 29, 2026, 6:48 p.m. OK Python 3 TESTS 3 46 0
360613042 varunnn_gupta A Jan. 29, 2026, 5:27 p.m. OK Rust 2024 TESTS 3 31 0

remove filters

Back to search problems