Codeforces Round 1079 (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
2196 Codeforces Round 1079 (Div. 1) FINISHED False 10800 5585123 Feb. 11, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2471 ) C2 Interactive Graph (Hard Version) PROGRAMMING combinatorics dfs and similar dp graphs interactive

This is the hard version of the problem. The difference between the versions is that in this version, you can ask no more than (n + m) questions, and (n \leq 30). You can hack only if you solved all versions of this problem. This is an interactive problem. The jury has thought of a directed acyclic graph without loops and multiple edges, which has (n) vertices and (m) edges. Your task is to determine which edges are in this graph. To do this, you can ask questions of the form: what does the (k)-th path look like in the lexicographically(^{\text{∗}}) sorted list of all paths in the graph. A path in the graph is a sequence of vertices (u_{1}, u_{2}, \dots, u_{l}), such that for any (i \lt l), there exists an edge ((u_{i}, u_{i + 1})) in the graph. Your task is to accomplish this by asking no more than (n + m) questions. (^{\text{∗}})A sequence (a) is lexicographically smaller than a sequence (b) if and only if one of the following holds: (a) is a prefix of (b), but (a \ne b); or in the first position where (a) and (b) differ, the sequence (a) has a smaller element than the corresponding element in (b). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10)). The description of the test cases follows. Each test case consists of a single line with an integer (n) ((1 \le n \le 30)) — the number of vertices in the graph. The jury guarantees that the given graph does not contain cycles or multiple edges. Note that (m) is unknown to you! The interaction for each test case begins with reading the integer (n). Then you can ask up to (n + m) questions. To ask a question, output a string in the format " ? k " (without quotes) ((1 \le k \le 2^{30})). After each question, read an integer (q) — the number of vertices in the (k)-th path. If (q = 0), then such a path does not exist; otherwise, re

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
362460279 -firefly- C2 Feb. 11, 2026, 3:29 p.m. OK C# 13 TESTS 29 93 14336000
362527805 MrAndria C2 Feb. 11, 2026, 5:33 p.m. OK C++17 (GCC 7-32) TESTS 29 31 102400
362445838 mickeyjung C2 Feb. 11, 2026, 3:10 p.m. OK C++17 (GCC 7-32) TESTS 29 31 102400
362577183 deefpried C2 Feb. 12, 2026, 5:37 a.m. OK C++17 (GCC 7-32) TESTS 29 46 102400
362576598 binaryDream C2 Feb. 12, 2026, 5:31 a.m. OK C++17 (GCC 7-32) TESTS 29 46 102400
362569884 AdiRish C2 Feb. 12, 2026, 4:05 a.m. OK C++17 (GCC 7-32) TESTS 29 46 102400
362569605 MayankSavaliya C2 Feb. 12, 2026, 4:02 a.m. OK C++17 (GCC 7-32) TESTS 29 46 102400
362566193 jiawenzhuo C2 Feb. 12, 2026, 3:14 a.m. OK C++17 (GCC 7-32) TESTS 29 46 102400
362557787 tataky C2 Feb. 11, 2026, 11:51 p.m. OK C++17 (GCC 7-32) TESTS 29 46 102400
362555869 bubbarob19 C2 Feb. 11, 2026, 10:56 p.m. OK C++17 (GCC 7-32) TESTS 29 46 102400
362520670 knightL C2 Feb. 11, 2026, 5:19 p.m. OK C++17 (GCC 7-32) TESTS 29 46 102400
362523264 radhya C2 Feb. 11, 2026, 5:24 p.m. OK C++20 (GCC 13-64) TESTS 29 31 102400
362517948 Zheng_iii C2 Feb. 11, 2026, 5:13 p.m. OK C++20 (GCC 13-64) TESTS 29 31 102400
362516412 goncharovmike C2 Feb. 11, 2026, 5:10 p.m. OK C++20 (GCC 13-64) TESTS 29 31 102400
362508857 GGOSHAB C2 Feb. 11, 2026, 4:53 p.m. OK C++20 (GCC 13-64) TESTS 29 31 102400
362505216 2114992323 C2 Feb. 11, 2026, 4:46 p.m. OK C++20 (GCC 13-64) TESTS 29 31 102400
362467873 Pagode_Paiva C2 Feb. 11, 2026, 3:39 p.m. OK C++20 (GCC 13-64) TESTS 29 31 102400
362465619 Zicrus C2 Feb. 11, 2026, 3:36 p.m. OK C++20 (GCC 13-64) TESTS 29 31 102400
362487218 systemStart C2 Feb. 11, 2026, 4:11 p.m. OK C++20 (GCC 13-64) TESTS 29 31 307200
362514049 BigSmurf C2 Feb. 11, 2026, 5:05 p.m. OK C++20 (GCC 13-64) TESTS 29 46 0
362502691 risujiroh C2 Feb. 11, 2026, 4:41 p.m. OK C++20 (GCC 13-64) TESTS 29 46 0
362563100 Fizonel C2 Feb. 12, 2026, 2:12 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 0
362513014 Just_A_Handsome_Guy C2 Feb. 11, 2026, 5:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 0
362567610 EduardoBrito C2 Feb. 12, 2026, 3:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 102400
362541521 RockSnow C2 Feb. 11, 2026, 7:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 102400
362518844 Harsh_kunwar C2 Feb. 11, 2026, 5:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 102400
362507795 sahasrad C2 Feb. 11, 2026, 4:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 102400
362498923 CoderAbhi27 C2 Feb. 11, 2026, 4:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 102400
362475641 RockSnow C2 Feb. 11, 2026, 3:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 102400
362457091 MAKMED1337 C2 Feb. 11, 2026, 3:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 102400
362510637 astilate C2 Feb. 11, 2026, 4:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 31 819200
362438000 hos.lyric C2 Feb. 11, 2026, 3:01 p.m. OK D TESTS 29 78 0
362471413 Gassa C2 Feb. 11, 2026, 3:45 p.m. OK D TESTS 29 93 102400
362471557 pengin_2000 C2 Feb. 11, 2026, 3:45 p.m. OK GNU C11 TESTS 29 46 8396800
362492802 iakovlev.zakhar C2 Feb. 11, 2026, 4:21 p.m. OK Java 21 TESTS 29 296 1536000
362507091 owenytz C2 Feb. 11, 2026, 4:50 p.m. OK Java 21 TESTS 29 312 1331200
362501345 gotexans C2 Feb. 11, 2026, 4:38 p.m. OK Java 8 TESTS 29 234 0
362555684 Golovanov399 C2 Feb. 11, 2026, 10:51 p.m. OK Kotlin 2.2 TESTS 29 203 102400
362450588 Tlatoani C2 Feb. 11, 2026, 3:16 p.m. OK Kotlin 2.2 TESTS 29 265 26009600
362467195 teekaytai C2 Feb. 11, 2026, 3:38 p.m. OK PyPy 3-64 TESTS 29 171 4300800
362477995 Jank C2 Feb. 11, 2026, 3:55 p.m. OK PyPy 3-64 TESTS 29 187 5222400
362516868 tassei903 C2 Feb. 11, 2026, 5:11 p.m. OK PyPy 3-64 TESTS 29 187 5427200
362488633 SadMachine C2 Feb. 11, 2026, 4:14 p.m. OK PyPy 3-64 TESTS 29 187 6758400
362522317 Ergodic137 C2 Feb. 11, 2026, 5:22 p.m. OK PyPy 3-64 TESTS 29 218 4505600
362447457 dyppp C2 Feb. 11, 2026, 3:12 p.m. OK PyPy 3-64 TESTS 29 218 6860800
362519829 Nikrien C2 Feb. 11, 2026, 5:17 p.m. OK PyPy 3-64 TESTS 29 218 6963200
362442829 literalchild C2 Feb. 11, 2026, 3:06 p.m. OK PyPy 3-64 TESTS 29 234 6758400
362445614 __baozii__ C2 Feb. 11, 2026, 3:10 p.m. OK PyPy 3-64 TESTS 29 234 7065600
362488698 shade34 C2 Feb. 11, 2026, 4:14 p.m. OK PyPy 3-64 TESTS 29 234 8704000
362461679 sansen C2 Feb. 11, 2026, 3:31 p.m. OK Rust 2021 TESTS 29 46 102400
362462890 DanielAnker C2 Feb. 11, 2026, 3:32 p.m. OK Rust 2024 TESTS 29 46 11776000
362457744 Egor C2 Feb. 11, 2026, 3:25 p.m. OK Rust 2024 TESTS 29 46 11776000
362487496 darkkcyan C2 Feb. 11, 2026, 4:12 p.m. OK Rust 2024 TESTS 29 62 11776000
362463908 Mon_ster C2 Feb. 11, 2026, 3:34 p.m. OK Rust 2024 TESTS 29 62 11776000

remove filters

Back to search problems