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 |
---|---|---|---|---|---|---|
1526 | Codeforces Round 723 (Div. 2) | FINISHED | False | 9000 | 115055662 | May 28, 2021, 2:05 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 304 ) | F | Median Queries | PROGRAMMING | constructive algorithms interactive probabilities |
B'This is an interactive problem. There is a secret permutation p ( 1 -indexed) of numbers from 1 to n . More formally, for 1 <= q i <= q n , 1 <= q p[i] <= q n and for 1 <= q i < j <= q n , p[i] neq p[j] . It is known that p[1]<p[2] . In 1 query, you give 3 distinct integers a,b,c ( 1 <= q a,b,c <= q n ), and receive the median of {|p[a]-p[b]|,|p[b]-p[c]|,|p[a]-p[c]| } . In this case, the median is the 2 -nd element ( 1 -indexed) of the sequence when sorted in non-decreasing order. The median of {4,6,2 } is 4 and the median of {0,123,33 } is 33 . Can you find the secret permutation in not more than 2n+420 queries? Note: the grader is not adaptive: the permutation is fixed before any queries are made. The first line of input contains a single integer t (1 <= q t <= q 1000) -- the number of testcases. The first line of each testcase consists of a single integer n (20 <= q n <= q 100000) -- the length of the secret permutation. It is guaranteed that the sum of n over all test cases does not exceed 100000 . For each testcase, you begin the interaction by reading n . To perform a query, output "? a b c" where a,b,c is the 3 indices you want to use for the query. Numbers have to satisfy 1 <= q a,b,c <= q n and a neq b , b neq c , a neq c . For each query, you will receive a single integer x : the median of {|p[a]-p[b]|,|p[b]-p[c]|,|p[a]-p[c]| } . In case your query is invalid or you asked more than 2n+420 queries, the interactor will print " xe2 x88 x921" and will finish interaction. You will receive Wrong answer verdict. Make sure to exit immediately to avoid getting other verdicts. When you have determined the secret permutation, output "! p[1] p[2] ... p[n]". If the secret permutation is correct, the interactor will print "1". Otherwise, the interactor will print '... |
Codeforces Round #723 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
117718090 | haojiandan | F | May 29, 2021, 2:48 a.m. | OK | GNU C++11 | TESTS | 75 | 1091 | 3481600 | ||
117724157 | deafff | F | May 29, 2021, 4:32 a.m. | OK | GNU C++11 | TESTS | 76 | 1482 | 3481600 | ||
117707052 | pikapikachu | F | May 28, 2021, 9:36 p.m. | OK | GNU C++11 | TESTS | 75 | 1699 | 3072000 | ||
117707030 | pikapikachu | F | May 28, 2021, 9:36 p.m. | OK | GNU C++11 | TESTS | 75 | 2042 | 5120000 | ||
117708185 | krijgertje | F | May 28, 2021, 10:12 p.m. | OK | GNU C++14 | TESTS | 75 | 2511 | 1433600 | ||
117717388 | Codeforces_is_rubbish | F | May 29, 2021, 2:33 a.m. | OK | GNU C++17 | TESTS | 75 | 1840 | 2048000 | ||
117685511 | user14767553 | F | May 28, 2021, 5:11 p.m. | OK | GNU C++17 | TESTS | 75 | 1903 | 1740800 | ||
117710839 | xulantu | F | May 29, 2021, 12:06 a.m. | OK | GNU C++17 | TESTS | 75 | 2152 | 819200 | ||
117685467 | user14767553 | F | May 28, 2021, 5:11 p.m. | OK | GNU C++17 | TESTS | 75 | 3369 | 1331200 | ||
117709621 | xulantu | F | May 28, 2021, 11:07 p.m. | OK | GNU C++17 | TESTS | 75 | 4601 | 819200 | ||
117717430 | fxhd | F | May 29, 2021, 2:34 a.m. | OK | GNU C++17 | TESTS | 75 | 4866 | 2048000 | ||
117717347 | froggyzhang | F | May 29, 2021, 2:32 a.m. | OK | GNU C++17 (64) | TESTS | 75 | 1528 | 4812800 | ||
117698349 | neal | F | May 28, 2021, 6:59 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 1528 | 6451200 | ||
117684964 | jiangly | F | May 28, 2021, 5:10 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 1590 | 819200 | ||
117687714 | kefaa2 | F | May 28, 2021, 5:24 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 1669 | 2457600 | ||
117686521 | Maksim1744 | F | May 28, 2021, 5:17 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 1684 | 6144000 | ||
117686266 | errorgorn | F | May 28, 2021, 5:15 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 1715 | 8601600 | ||
117719522 | qazswedx2 | F | May 29, 2021, 3:15 a.m. | OK | GNU C++17 (64) | TESTS | 75 | 1918 | 1945600 | ||
117686240 | nuip | F | May 28, 2021, 5:15 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 1918 | 23449600 | ||
117715481 | wlzhouzhuan | F | May 29, 2021, 1:50 a.m. | OK | GNU C++17 (64) | TESTS | 75 | 2027 | 4300800 | ||
117685358 | errorgorn | F | May 28, 2021, 5:11 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 2574 | 1638400 | ||
117726205 | sh1194 | F | May 29, 2021, 4:59 a.m. | OK | Python 3 | TESTS | 76 | 5147 | 11264000 | ||
117685592 | user14767553 | F | May 28, 2021, 5:12 p.m. | OK | Python 3 | TESTS | 75 | 5319 | 11264000 | ||
117725933 | sh1194 | F | May 29, 2021, 4:56 a.m. | OK | Python 3 | TESTS | 76 | 5366 | 11878400 | ||
117698000 | rpashuto | F | May 28, 2021, 6:55 p.m. | OK | Python 3 + libs | TESTS | 75 | 4352 | 0 |
Back to search problems