Codeforces Round 838 (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
1762 Codeforces Round 838 (Div. 2) FINISHED False 9000 66151463 Dec. 15, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3747 ) D GCD Queries PROGRAMMING interactive number theory

B'This is an interactive problem. There is a secret permutation p of [0,1,2, ldots,n-1] . Your task is to find 2 indices x and y ( 1 <= q x, y <= q n , possibly x=y ) such that p_x=0 or p_y=0 . In order to find it, you are allowed to ask at most 2n queries. In one query, you give two integers i and j ( 1 <= q i, j <= q n , i neq j ) and receive the value of gcd(p_i,p_j)^ dagger . Note that the permutation p is fixed before any queries are made and does not depend on the queries. ^ dagger gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y . Note that gcd(x,0)= gcd(0,x)=x for all positive integers x . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= q t <= q 10^4 ). The description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= q n <= q 2 cdot 10^4 ). After reading the integer n for each test case, you should begin the interaction. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^4 . The interaction for each test case begins by reading the integer n . To make a query, output "? i j " ( 1 <= q i, j <= q n , i neq j ) without quotes. Afterwards, you should read a single integer -- the answer to your query gcd(p_i,p_j) . You can make at most 2n such queries in each test case. If you want to print the answer, output "! x y " ( 1 <= q x, y <= q n ) without quotes. After doing that, read 1 or -1 . If p_x=0 or p_y=0 , you 'll receive 1 , otherwise you 'll receive -1 . If you receive -1 , your program must terminate immediately to receive a Wrong Answer verdict. Otherwise, you can get an arbitrary verdict because your solution will continue to read from a closed stream. I'...

Tutorials

Codeforces Round #838 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
185392608 Sofapuden D Dec. 15, 2022, 8:41 p.m. OK GNU C11 TESTS 27 233 0
185405317 Yuki991 D Dec. 16, 2022, 2:08 a.m. OK GNU C++14 TESTS 27 233 0
185417785 Hridoy23 D Dec. 16, 2022, 5:55 a.m. OK GNU C++14 TESTS 28 233 204800
185361862 zmy_ D Dec. 15, 2022, 4:42 p.m. OK GNU C++14 TESTS 25 248 2048000
185373201 __wizard_of_oz__ D Dec. 15, 2022, 5:33 p.m. OK GNU C++14 TESTS 25 248 2048000
185378193 arisingstar D Dec. 15, 2022, 6:07 p.m. OK GNU C++14 TESTS 26 249 0
185399839 rsrsr D Dec. 15, 2022, 11:19 p.m. OK GNU C++14 TESTS 27 249 0
185404044 lyuzlion D Dec. 16, 2022, 1:31 a.m. OK GNU C++14 TESTS 27 249 204800
185408553 lg_zhou D Dec. 16, 2022, 3:26 a.m. OK GNU C++14 TESTS 27 249 409600
185369912 xuan13853715014 D Dec. 15, 2022, 5:04 p.m. OK GNU C++14 TESTS 25 249 1024000
185413542 OrazB D Dec. 16, 2022, 4:59 a.m. OK GNU C++14 TESTS 28 249 2048000
185387900 Light_KG D Dec. 15, 2022, 7:41 p.m. OK GNU C++17 TESTS 26 171 1331200
185368754 rohan.p D Dec. 15, 2022, 5:02 p.m. OK GNU C++17 TESTS 25 186 43827200
185368888 Grzechu444 D Dec. 15, 2022, 5:02 p.m. OK GNU C++17 TESTS 25 187 819200
185408841 The_Crossing D Dec. 16, 2022, 3:33 a.m. OK GNU C++17 TESTS 27 202 102400
185405897 yqlm D Dec. 16, 2022, 2:22 a.m. OK GNU C++17 TESTS 27 217 0
185406334 chhokmaha D Dec. 16, 2022, 2:33 a.m. OK GNU C++17 TESTS 27 217 0
185375864 vibhug507 D Dec. 15, 2022, 5:50 p.m. OK GNU C++17 TESTS 25 217 307200
185380191 vansh_s D Dec. 15, 2022, 6:22 p.m. OK GNU C++17 TESTS 26 217 2867200
185375783 longcheng_x D Dec. 15, 2022, 5:49 p.m. OK GNU C++17 TESTS 25 218 0
185397967 MDKIP D Dec. 15, 2022, 10:25 p.m. OK GNU C++17 TESTS 27 218 0
185398338 enslaved D Dec. 15, 2022, 10:36 p.m. OK GNU C++17 (64) TESTS 27 202 204800
185408287 JYJin D Dec. 16, 2022, 3:20 a.m. OK GNU C++17 (64) TESTS 27 202 409600
185375703 qfl_zzz D Dec. 15, 2022, 5:49 p.m. OK GNU C++17 (64) TESTS 25 233 0
185371829 GILGAMESH D Dec. 15, 2022, 5:26 p.m. OK GNU C++17 (64) TESTS 25 233 512000
185367291 LJY--2002 D Dec. 15, 2022, 4:58 p.m. OK GNU C++17 (64) TESTS 25 233 1843200
185376349 shy0729 D Dec. 15, 2022, 5:53 p.m. OK GNU C++17 (64) TESTS 25 249 409600
185370026 fexla D Dec. 15, 2022, 5:04 p.m. OK GNU C++17 (64) TESTS 25 249 1536000
185380524 Roshin D Dec. 15, 2022, 6:25 p.m. OK GNU C++17 (64) TESTS 26 264 1024000
185408826 reknis D Dec. 16, 2022, 3:33 a.m. OK GNU C++17 (64) TESTS 27 264 32051200
185401767 Kano1224 D Dec. 16, 2022, 12:25 a.m. OK GNU C++17 (64) TESTS 27 265 307200
185369043 coding_sword D Dec. 15, 2022, 5:02 p.m. OK GNU C++20 (64) TESTS 25 171 921600
185374499 canonica1 D Dec. 15, 2022, 5:40 p.m. OK GNU C++20 (64) TESTS 25 186 921600
185376594 pranabpandey D Dec. 15, 2022, 5:55 p.m. OK GNU C++20 (64) TESTS 25 187 1331200
185374273 Mirali7 D Dec. 15, 2022, 5:39 p.m. OK GNU C++20 (64) TESTS 25 187 1331200
185374487 y_dove D Dec. 15, 2022, 5:40 p.m. OK GNU C++20 (64) TESTS 25 187 12083200
185376000 achvanov D Dec. 15, 2022, 5:51 p.m. OK GNU C++20 (64) TESTS 25 202 409600
185385449 mknayam D Dec. 15, 2022, 7:12 p.m. OK GNU C++20 (64) TESTS 26 202 716800
185379032 tyan.by D Dec. 15, 2022, 6:13 p.m. OK GNU C++20 (64) TESTS 26 202 716800
185367872 WAtoAC2001 D Dec. 15, 2022, 4:59 p.m. OK GNU C++20 (64) TESTS 25 202 921600
185375872 towrist D Dec. 15, 2022, 5:50 p.m. OK GNU C++20 (64) TESTS 25 217 307200
185404368 im0use D Dec. 16, 2022, 1:41 a.m. OK Java 11 TESTS 27 1044 0
185376474 profchi D Dec. 15, 2022, 5:54 p.m. OK Java 11 TESTS 25 1044 0
185392031 HeXecutor D Dec. 15, 2022, 8:33 p.m. OK Java 11 TESTS 27 1138 204800
185379743 Nicolas125841 D Dec. 15, 2022, 6:19 p.m. OK Java 11 TESTS 26 1154 204800
185391854 HeXecutor D Dec. 15, 2022, 8:31 p.m. OK Java 11 TESTS 27 1247 204800
185366659 Abhishek_patel_ D Dec. 15, 2022, 4:56 p.m. OK Java 11 TESTS 25 1325 0
185402200 dzhi D Dec. 16, 2022, 12:37 a.m. OK Java 11 TESTS 27 1466 0
185405632 im0use D Dec. 16, 2022, 2:15 a.m. OK Java 11 TESTS 27 1528 0
185402477 dzhi D Dec. 16, 2022, 12:46 a.m. OK Java 11 TESTS 27 1560 0
185368081 ashutosh_patel D Dec. 15, 2022, 5 p.m. OK Java 11 TESTS 25 1871 409600
185381261 merlin_ D Dec. 15, 2022, 6:31 p.m. OK Java 17 TESTS 26 1263 614400
185375595 TCchen D Dec. 15, 2022, 5:48 p.m. OK Java 17 TESTS 25 1528 1228800
185374700 DWSHR_1 D Dec. 15, 2022, 5:42 p.m. OK Java 17 TESTS 25 1590 512000
185408230 frey4 D Dec. 16, 2022, 3:19 a.m. OK Java 17 TESTS 27 1622 1024000
185404533 omeganot D Dec. 16, 2022, 1:45 a.m. OK Java 8 TESTS 27 1387 38297600
185404292 NerfThis D Dec. 16, 2022, 1:39 a.m. OK Java 8 TESTS 27 1403 0
185382748 mwen D Dec. 15, 2022, 6:44 p.m. OK Java 8 TESTS 26 1435 0
185387720 gagan_6730 D Dec. 15, 2022, 7:39 p.m. OK Java 8 TESTS 26 1466 0
185383044 sky D Dec. 15, 2022, 6:47 p.m. OK Kotlin 1.7 TESTS 26 936 26624000
185416352 CtrlACtrlV D Dec. 16, 2022, 5:37 a.m. OK MS C++ 2017 TESTS 28 514 0
185372192 fireSlayer57 D Dec. 15, 2022, 5:28 p.m. OK PyPy 3 TESTS 25 1153 8704000
185389878 shobonvip D Dec. 15, 2022, 8:05 p.m. OK PyPy 3 TESTS 27 1169 11366400
185413501 rajeshpenugonda6 D Dec. 16, 2022, 4:58 a.m. OK PyPy 3 TESTS 28 1341 17100800
185409976 Ayushman_123 D Dec. 16, 2022, 3:58 a.m. OK PyPy 3 TESTS 28 1840 10342400
185362130 9.86960440109 D Dec. 15, 2022, 4:43 p.m. OK PyPy 3-64 TESTS 25 967 11161600
185377734 manish.17 D Dec. 15, 2022, 6:04 p.m. OK PyPy 3-64 TESTS 26 998 12902400
185373277 1_2_3_4_5_9 D Dec. 15, 2022, 5:33 p.m. OK PyPy 3-64 TESTS 25 1029 24268800
185375927 ZrjaK D Dec. 15, 2022, 5:50 p.m. OK PyPy 3-64 TESTS 25 1044 13619200
185362646 katonyonko D Dec. 15, 2022, 4:45 p.m. OK PyPy 3-64 TESTS 25 1045 10547200
185393467 beethoven97 D Dec. 15, 2022, 8:54 p.m. OK PyPy 3-64 TESTS 27 1060 6553600
185393524 beethoven97 D Dec. 15, 2022, 8:55 p.m. OK PyPy 3-64 TESTS 27 1060 8908800
185393568 beethoven97 D Dec. 15, 2022, 8:55 p.m. OK PyPy 3-64 TESTS 27 1060 9932800
185400591 onemoreq D Dec. 15, 2022, 11:42 p.m. OK PyPy 3-64 TESTS 27 1060 10547200
185393320 beethoven97 D Dec. 15, 2022, 8:52 p.m. OK PyPy 3-64 TESTS 27 1091 6451200
185400039 carlfre D Dec. 15, 2022, 11:25 p.m. OK Python 3 TESTS 27 717 614400
185374771 MrDrogon D Dec. 15, 2022, 5:42 p.m. OK Python 3 TESTS 25 748 1945600
185373901 mguliyev12360 D Dec. 15, 2022, 5:37 p.m. OK Python 3 TESTS 25 1107 716800
185373310 aayush_chhabra D Dec. 15, 2022, 5:34 p.m. OK Python 3 TESTS 25 1107 716800

remove filters

Back to search problems