Codeforces Round 1073 (Div. 1)

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
2190 Codeforces Round 1073 (Div. 1) FINISHED False 10800 7745123 Jan. 17, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1280 ) C Comparable Permutations PROGRAMMING binary search greedy interactive sortings two pointers

This is an interactive problem. For a permutation(^{\text{∗}}) (g = (g_1, g_2, \ldots, g_m)), define its reverse as (\operatorname{rev}(g) = (g_m, g_{m-1}, \ldots, g_1)). There is a hidden permutation (p) of size (n). Your task is to find the lexicographically smallest(^{\text{†}}) permutation (q) of size (n) such that (q > p) and (\operatorname{rev}(q) > \operatorname{rev}(p)). However, you do not need to output (q) itself. Instead, you must output a permutation (r) of size (n) such that (q_i = p_{r_i}) for all (1 \le i \le n). If no such (q) exists, report that instead. To find the answer, you can ask at most (3n) queries of the form (? i \; j) ((1 \le i, j \le n)). The interactor responds with (1) if (p_i < p_j) and (0) otherwise. The interactor is not adaptive , which means that the permutation (p) is fixed throughout the interaction. (^{\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 (x) is lexicographically smaller than array (y) (so (x < y)) if and only if one of the following holds: (x) is a prefix of (y), but (x \ne y); or Let (i) be the first position where (x_i \neq y_i) (if it exists), then (x_i < y_i). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((2 \le n \le 2 \cdot 10^4)) — the size of the hidden permutation (p). The hidden permutation (p) is fixed for the test case and does no

Tutorials

Codeforces Round 1073 (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
358401299 ywjylx C Jan. 18, 2026, 3:18 a.m. OK C++17 (GCC 7-32) TESTS 39 125 204800
358365744 Spaceshadow20 C Jan. 17, 2026, 5:24 p.m. OK C++17 (GCC 7-32) TESTS 39 125 409600
358397729 bubbarob19 C Jan. 18, 2026, 1:51 a.m. OK C++17 (GCC 7-32) TESTS 39 156 102400
358395739 togetherfrist C Jan. 18, 2026, 12:46 a.m. OK C++17 (GCC 7-32) TESTS 39 156 102400
358391287 Mosaab. C Jan. 17, 2026, 9:49 p.m. OK C++17 (GCC 7-32) TESTS 39 156 102400
358338685 Door_Dark_We C Jan. 17, 2026, 4:13 p.m. OK C++17 (GCC 7-32) TESTS 39 156 102400
358396458 CCCCOrz C Jan. 18, 2026, 1:14 a.m. OK C++17 (GCC 7-32) TESTS 39 156 204800
358342195 Watersphere C Jan. 17, 2026, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 39 156 204800
358313034 JDScript0117 C Jan. 17, 2026, 3:30 p.m. OK C++17 (GCC 7-32) TESTS 39 156 204800
358346727 frznhc C Jan. 17, 2026, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 39 156 1638400
358398091 lhy123 C Jan. 18, 2026, 2:01 a.m. OK C++20 (GCC 13-64) TESTS 39 109 102400
358337438 logIse C Jan. 17, 2026, 4:11 p.m. OK C++20 (GCC 13-64) TESTS 39 109 204800
358396136 jianylg C Jan. 18, 2026, 1:03 a.m. OK C++20 (GCC 13-64) TESTS 39 109 1126400
358401190 xly_tyty C Jan. 18, 2026, 3:16 a.m. OK C++20 (GCC 13-64) TESTS 39 109 2457600
358346838 FelixMP C Jan. 17, 2026, 4:31 p.m. OK C++20 (GCC 13-64) TESTS 39 125 0
358332392 tarjen C Jan. 17, 2026, 4:01 p.m. OK C++20 (GCC 13-64) TESTS 39 125 0
358402175 Sanae C Jan. 18, 2026, 3:37 a.m. OK C++20 (GCC 13-64) TESTS 39 125 819200
358339586 Mapakaka C Jan. 17, 2026, 4:15 p.m. OK C++20 (GCC 13-64) TESTS 39 125 1638400
358388642 lbm47 C Jan. 17, 2026, 8:59 p.m. OK C++20 (GCC 13-64) TESTS 39 140 0
358355962 WeirdoAru C Jan. 17, 2026, 4:55 p.m. OK C++20 (GCC 13-64) TESTS 39 140 0
358402281 The_Mad_Max C Jan. 18, 2026, 3:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 39 93 0
358375174 Ladamalina C Jan. 17, 2026, 6:39 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 109 102400
358297716 jiangly C Jan. 17, 2026, 3:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 109 102400
358397054 bonopo C Jan. 18, 2026, 1:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 39 109 204800
358379692 Hori C Jan. 17, 2026, 7:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 125 102400
358379197 man_of_learning C Jan. 17, 2026, 7:11 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 125 102400
358363678 zyadhany C Jan. 17, 2026, 5:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 125 102400
358357291 alzahrawi C Jan. 17, 2026, 4:59 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 125 102400
358342171 Mindeveloped C Jan. 17, 2026, 4:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 125 102400
358334961 anmichi C Jan. 17, 2026, 4:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 125 102400
358360647 pengin_2000 C Jan. 17, 2026, 5:08 p.m. OK GNU C11 TESTS 39 187 8499200
358327659 Ritwin C Jan. 17, 2026, 3:52 p.m. OK GNU C11 TESTS 39 468 9932800
358345597 khuepr123 C Jan. 17, 2026, 4:28 p.m. OK Haskell TESTS 39 984 4300800
358404105 MBBN C Jan. 18, 2026, 4:14 a.m. OK Java 21 TESTS 39 437 716800
358379814 lybord C Jan. 17, 2026, 7:17 p.m. OK Java 21 TESTS 39 515 1126400
358358751 malachi_toney_goat C Jan. 17, 2026, 5:03 p.m. OK Java 8 TESTS 39 578 0
358322737 Tlatoani C Jan. 17, 2026, 3:44 p.m. OK Kotlin 2.2 TESTS 39 453 24064000
358389284 bronze_coder C Jan. 17, 2026, 9:09 p.m. OK PyPy 3-64 TESTS 39 625 10035200
358375152 Emikooh C Jan. 17, 2026, 6:39 p.m. OK PyPy 3-64 TESTS 39 640 7577600
358363579 kdy8128 C Jan. 17, 2026, 5:18 p.m. OK PyPy 3-64 TESTS 39 640 9011200
358400902 SPD_9X2 C Jan. 18, 2026, 3:09 a.m. OK PyPy 3-64 TESTS 39 656 10342400
358354083 Maruzensky C Jan. 17, 2026, 4:49 p.m. OK PyPy 3-64 TESTS 39 671 8396800
358374371 teekaytai C Jan. 17, 2026, 6:34 p.m. OK PyPy 3-64 TESTS 39 687 7782400
358356666 gs25010 C Jan. 17, 2026, 4:57 p.m. OK PyPy 3-64 TESTS 39 718 9728000
358398706 Little_Sheep_Yawn C Jan. 18, 2026, 2:16 a.m. OK PyPy 3-64 TESTS 39 750 10342400
358327565 Go_Goat_Goal C Jan. 17, 2026, 3:52 p.m. OK PyPy 3-64 TESTS 39 750 10342400
358314075 literalchild C Jan. 17, 2026, 3:31 p.m. OK PyPy 3-64 TESTS 39 765 9523200
358359610 Jimanbanashi C Jan. 17, 2026, 5:05 p.m. OK Python 2 TESTS 39 406 102400
358354220 lunyi C Jan. 17, 2026, 4:50 p.m. OK Python 3 TESTS 39 546 3993600
358331281 sansen C Jan. 17, 2026, 3:59 p.m. OK Rust 2021 TESTS 39 203 0
358352261 Solalyth C Jan. 17, 2026, 4:44 p.m. OK Rust 2021 TESTS 39 203 13926400
358366964 Darknef C Jan. 17, 2026, 5:28 p.m. OK Rust 2024 TESTS 39 125 11673600

remove filters

Back to search problems