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 |
|---|---|---|---|---|---|---|
| 2156 | Codeforces Round 1061 (Div. 2) | FINISHED | False | 7200 | 15089123 | Oct. 24, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 5337 ) | D | Find the Last Number | PROGRAMMING | bitmasks constructive algorithms interactive math |
This is an interactive problem. There is a hidden permutation(^{\text{∗}}) (p) of length (n). You are allowed to interact with it by asking the following query at most (2n) times: Select two integers (i) and (x) such that (1\le i\le \boldsymbol{n - 1}) and (1\le x\le 10^9). The grader will respond (\mathtt{0}) if (p_i \mathbin{\&} x)(^{\text{†}}) is equal to zero, and (\mathtt{1}) otherwise. Important : You cannot make queries involving the last element (p_n) (because (i\le n - 1)). Your goal is to determine the value of the last element of the permutation, (p_n), using at most (2n) queries. Note that the interactor is non-adaptive. This means that the hidden permutation (p) is fixed at the beginning and will not change based on your queries. (^{\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{†}})(\&) denotes the bitwise AND operation . Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^3)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((2 \leq n \leq 2 \cdot 10^4)) — the length of permutation (p). For each test case, after reading (n), you should begin the interaction and find the answer before proceeding to the next test case. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^4). To make a query, output a single line in the following format: (\mathtt{?}\;i\;x) ((1\le i\le n - 1), (1\le x\le 10^9)) — the index to query and the value to take bitwise AND with. After each qu |
| Codeforces Round 1061 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 345683665 | Liu_Rui | D | Oct. 25, 2025, 4:53 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 296 | 0 | ||
| 345658098 | -Guts | D | Oct. 24, 2025, 8:49 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 311 | 0 | ||
| 345676697 | holygoat | D | Oct. 25, 2025, 3:18 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 312 | 0 | ||
| 345674341 | zenwraight | D | Oct. 25, 2025, 2:39 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 312 | 0 | ||
| 345674301 | HFDYW | D | Oct. 25, 2025, 2:38 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 312 | 0 | ||
| 345626518 | anshulagarwal2003 | D | Oct. 24, 2025, 5:44 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 312 | 0 | ||
| 345670077 | K32NGUYENKHANH | D | Oct. 25, 2025, 1:11 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 312 | 102400 | ||
| 345616597 | claudioSimeoni | D | Oct. 24, 2025, 4:31 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 312 | 102400 | ||
| 345671731 | ywb-33 | D | Oct. 25, 2025, 1:50 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 312 | 204800 | ||
| 345686725 | _dop_ | D | Oct. 25, 2025, 5:28 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 312 | 8089600 | ||
| 345672349 | iwnl | D | Oct. 25, 2025, 2:03 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 281 | 0 | ||
| 345640515 | Dinhquang06 | D | Oct. 24, 2025, 6:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 281 | 16179200 | ||
| 345684380 | Spartan-007 | D | Oct. 25, 2025, 5:02 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 296 | 0 | ||
| 345676597 | kmiao | D | Oct. 25, 2025, 3:16 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 296 | 0 | ||
| 345668994 | Sankiii | D | Oct. 25, 2025, 12:45 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 296 | 0 | ||
| 345667310 | liujuhan_2027 | D | Oct. 24, 2025, 11:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 296 | 0 | ||
| 345644966 | gopro2025master | D | Oct. 24, 2025, 6:53 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 296 | 0 | ||
| 345638836 | lyt-715 | D | Oct. 24, 2025, 6:19 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 296 | 0 | ||
| 345635438 | TheSoltion12 | D | Oct. 24, 2025, 6:06 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 296 | 0 | ||
| 345627952 | pranavsingh0111 | D | Oct. 24, 2025, 5:50 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 296 | 0 | ||
| 345685330 | LouisHurtin | D | Oct. 25, 2025, 5:13 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 265 | 0 | ||
| 345636982 | herewegoagain2025 | D | Oct. 24, 2025, 6:10 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 280 | 0 | ||
| 345674842 | anyanqio | D | Oct. 25, 2025, 2:48 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 281 | 0 | ||
| 345626863 | echo11111 | D | Oct. 24, 2025, 5:45 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 281 | 102400 | ||
| 345685213 | AllFiction | D | Oct. 25, 2025, 5:11 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 296 | 0 | ||
| 345684168 | motongyu | D | Oct. 25, 2025, 4:59 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 296 | 0 | ||
| 345683588 | singhnaad | D | Oct. 25, 2025, 4:52 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 296 | 0 | ||
| 345682542 | naaddiv3 | D | Oct. 25, 2025, 4:40 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 296 | 0 | ||
| 345679307 | Zahraa-a1839 | D | Oct. 25, 2025, 3:56 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 296 | 0 | ||
| 345679248 | z.a1839 | D | Oct. 25, 2025, 3:55 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 296 | 0 | ||
| 345648768 | man-ray | D | Oct. 24, 2025, 7:21 p.m. | OK | Java 21 | TESTS | 30 | 1030 | 1126400 | ||
| 345658399 | BiggestFish06 | D | Oct. 24, 2025, 8:53 p.m. | OK | Java 21 | TESTS | 30 | 1046 | 1945600 | ||
| 345615031 | flashinglight333 | D | Oct. 24, 2025, 4:29 p.m. | OK | Java 21 | TESTS | 30 | 1093 | 1024000 | ||
| 345650757 | Burhan_Akkus | D | Oct. 24, 2025, 7:36 p.m. | OK | Java 21 | TESTS | 30 | 1124 | 1331200 | ||
| 345648545 | man-ray | D | Oct. 24, 2025, 7:19 p.m. | OK | Java 21 | TESTS | 30 | 1125 | 2252800 | ||
| 345676505 | wenbozh | D | Oct. 25, 2025, 3:15 a.m. | OK | Java 21 | TESTS | 30 | 1140 | 2560000 | ||
| 345668515 | mastacoda | D | Oct. 25, 2025, 12:33 a.m. | OK | Java 21 | TESTS | 30 | 1186 | 7168000 | ||
| 345643523 | WrongAnswerOnTestCase2 | D | Oct. 24, 2025, 6:44 p.m. | OK | Java 21 | TESTS | 30 | 1218 | 1740800 | ||
| 345658260 | vineetiwari | D | Oct. 24, 2025, 8:51 p.m. | OK | Java 21 | TESTS | 30 | 1249 | 1638400 | ||
| 345659631 | vatsal_04 | D | Oct. 24, 2025, 9:08 p.m. | OK | Java 21 | TESTS | 30 | 1249 | 2048000 | ||
| 345642887 | arif318khan | D | Oct. 24, 2025, 6:41 p.m. | OK | Kotlin 2.2 | TESTS | 30 | 640 | 0 | ||
| 345640713 | marcin7cd | D | Oct. 24, 2025, 6:29 p.m. | OK | PyPy 3 | TESTS | 30 | 1264 | 9830400 | ||
| 345657026 | _Gawd_ | D | Oct. 24, 2025, 8:37 p.m. | OK | PyPy 3 | TESTS | 30 | 1280 | 9830400 | ||
| 345666361 | denilb | D | Oct. 24, 2025, 11:23 p.m. | OK | PyPy 3-64 | TESTS | 30 | 640 | 7782400 | ||
| 345627142 | coderrg21 | D | Oct. 24, 2025, 5:46 p.m. | OK | PyPy 3-64 | TESTS | 30 | 796 | 5120000 | ||
| 345674060 | LogicErr | D | Oct. 25, 2025, 2:34 a.m. | OK | PyPy 3-64 | TESTS | 30 | 796 | 6451200 | ||
| 345613402 | traced | D | Oct. 24, 2025, 4:26 p.m. | OK | PyPy 3-64 | TESTS | 30 | 812 | 5427200 | ||
| 345666728 | 34z12000 | D | Oct. 24, 2025, 11:35 p.m. | OK | PyPy 3-64 | TESTS | 30 | 827 | 8908800 | ||
| 345644593 | helltractor | D | Oct. 24, 2025, 6:51 p.m. | OK | PyPy 3-64 | TESTS | 30 | 828 | 12185600 | ||
| 345651729 | twosquares | D | Oct. 24, 2025, 7:44 p.m. | OK | PyPy 3-64 | TESTS | 30 | 842 | 12185600 | ||
| 345650227 | SoleProprietor | D | Oct. 24, 2025, 7:32 p.m. | OK | PyPy 3-64 | TESTS | 30 | 843 | 6144000 | ||
| 345665430 | eugenechka.boyko.2_0-0 | D | Oct. 24, 2025, 10:56 p.m. | OK | PyPy 3-64 | TESTS | 30 | 843 | 8601600 | ||
| 345623329 | kryoton_98 | D | Oct. 24, 2025, 5:29 p.m. | OK | PyPy 3-64 | TESTS | 30 | 843 | 8601600 | ||
| 345658535 | davidmiheev | D | Oct. 24, 2025, 8:54 p.m. | OK | Python 3 | TESTS | 30 | 687 | 12390400 | ||
| 345614303 | RRoy_45 | D | Oct. 24, 2025, 4:28 p.m. | OK | Python 3 | TESTS | 30 | 718 | 2252800 | ||
| 345684614 | xiaogan881 | D | Oct. 25, 2025, 5:05 a.m. | OK | Python 3 | TESTS | 30 | 764 | 8294400 | ||
| 345640566 | amod_24 | D | Oct. 24, 2025, 6:28 p.m. | OK | Python 3 | TESTS | 30 | 936 | 2048000 | ||
| 345658255 | Pepengu | D | Oct. 24, 2025, 8:51 p.m. | OK | Rust 2024 | TESTS | 30 | 421 | 102400 |
Back to search problems