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 |
|---|---|---|---|---|---|---|
| 263 | Codeforces Round 161 (Div. 2) | FINISHED | False | 7200 | 418055423 | Jan. 16, 2013, 3:30 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1133 ) | C | Circle of Numbers | PROGRAMMING | brute force dfs and similar implementation | 2000 |
One day Vasya came up to the blackboard and wrote out n distinct integers from 1 to n in some order in a circle. Then he drew arcs to join the pairs of integers ( a , b ) ( a ≠ b ) , that are either each other's immediate neighbors in the circle, or there is number c , such that a and с are immediate neighbors, and b and c are immediate neighbors. As you can easily deduce, in the end Vasya drew 2· n arcs. For example, if the numbers are written in the circle in the order 1, 2, 3, 4, 5 (in the clockwise direction), then the arcs will join pairs of integers (1, 2) , (2, 3) , (3, 4) , (4, 5) , (5, 1) , (1, 3) , (2, 4) , (3, 5) , (4, 1) and (5, 2) . Much time has passed ever since, the numbers we wiped off the blackboard long ago, but recently Vasya has found a piece of paper with 2· n written pairs of integers that were joined with the arcs on the board. Vasya asks you to find the order of numbers in the circle by these pairs. The first line of the input contains a single integer n ( 5 ≤ n ≤ 10 5 ) that shows, how many numbers were written on the board. Next 2· n lines contain pairs of integers a i , b i ( 1 ≤ a i , b i ≤ n , a i ≠ b i ) — the numbers that were connected by the arcs. It is guaranteed that no pair of integers, connected by a arc, occurs in the input more than once. The pairs of numbers and the numbers in the pairs are given in the arbitrary order. If Vasya made a mistake somewhere and there isn't any way to place numbers from 1 to n on the circle according to the statement, then print a single number "-1" (without the quotes). Otherwise, print any suitable sequence of n distinct integers from 1 to n . If there are multiple solutions, you are allowed to print any of them. Specifically, it doesn't matter which number you write first to describe the sequence of the order. It also doesn't matter whether you write out the numbers in the clockwise or counter-clockwise direction. |
| Codeforces Round #161 Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 40990311 | ReaLNero1 | C | July 30, 2018, 11:47 p.m. | OK | Delphi | TESTS | 45 | 154 | 5427200 | 2000 | |
| 38413882 | Scut82 | C | May 19, 2018, 1:30 a.m. | OK | GNU C++ | TESTS | 45 | 186 | 6144000 | 2000 | |
| 38265078 | Scut82 | C | May 15, 2018, 11:02 a.m. | OK | GNU C++ | TESTS | 45 | 996 | 27750400 | 2000 | |
| 58780164 | rainboy | C | Aug. 13, 2019, 7:08 p.m. | OK | GNU C11 | TESTS | 45 | 810 | 2457600 | 2000 | |
| 59226296 | vjudge4 | C | Aug. 21, 2019, 1:52 p.m. | OK | GNU C++11 | TESTS | 45 | 218 | 17612800 | 2000 | |
| 54499952 | WOSHIGEPACHONG2 | C | May 22, 2019, 8:05 p.m. | OK | GNU C++11 | TESTS | 45 | 248 | 5222400 | 2000 | |
| 59226353 | vjudge5 | C | Aug. 21, 2019, 1:53 p.m. | OK | GNU C++11 | TESTS | 45 | 248 | 17612800 | 2000 | |
| 36570827 | chetan52720 | C | March 24, 2018, 10:22 a.m. | OK | GNU C++11 | TESTS | 45 | 278 | 9011200 | 2000 | |
| 42605955 | starry_tales | C | Sept. 7, 2018, 7:51 a.m. | OK | GNU C++11 | TESTS | 45 | 280 | 5222400 | 2000 | |
| 57897787 | lopare | C | July 28, 2019, 2:20 p.m. | OK | GNU C++11 | TESTS | 45 | 436 | 21606400 | 2000 | |
| 57821570 | py_ultron | C | July 26, 2019, 11:46 p.m. | OK | GNU C++11 | TESTS | 45 | 466 | 21606400 | 2000 | |
| 64088281 | luengjon | C | Nov. 2, 2019, 11:57 a.m. | OK | GNU C++11 | TESTS | 45 | 592 | 12492800 | 2000 | |
| 39054394 | wasyl | C | June 8, 2018, 8:14 p.m. | OK | GNU C++11 | TESTS | 45 | 684 | 5529600 | 2000 | |
| 36570886 | chetan52720 | C | March 24, 2018, 10:25 a.m. | OK | GNU C++11 | TESTS | 45 | 842 | 35430400 | 2000 | |
| 40249796 | CaNDidaTE_FaSTer | C | July 13, 2018, 5:16 a.m. | OK | GNU C++14 | TESTS | 45 | 248 | 7577600 | 2000 | |
| 59223363 | vjudge4 | C | Aug. 21, 2019, 1 p.m. | OK | GNU C++14 | TESTS | 45 | 248 | 51507200 | 2000 | |
| 59246877 | vjudge1 | C | Aug. 22, 2019, 12:43 a.m. | OK | GNU C++14 | TESTS | 45 | 248 | 51507200 | 2000 | |
| 54501735 | Kar98k | C | May 22, 2019, 9:28 p.m. | OK | GNU C++14 | TESTS | 45 | 280 | 6041600 | 2000 | |
| 46297972 | dmkozyrev | C | Nov. 28, 2018, 5:14 a.m. | OK | GNU C++14 | TESTS | 45 | 280 | 6144000 | 2000 | |
| 63079383 | stefdasca | C | Oct. 21, 2019, 2:38 p.m. | OK | GNU C++14 | TESTS | 45 | 280 | 15360000 | 2000 | |
| 50612554 | BamiTorabi | C | Feb. 28, 2019, 5:35 p.m. | OK | GNU C++14 | TESTS | 45 | 310 | 6041600 | 2000 | |
| 46297907 | dmkozyrev | C | Nov. 28, 2018, 5:09 a.m. | OK | GNU C++14 | TESTS | 45 | 310 | 6144000 | 2000 | |
| 35983420 | WarBoy | C | March 6, 2018, 7 a.m. | OK | GNU C++14 | TESTS | 45 | 340 | 8192000 | 2000 | |
| 45317356 | ZNI | C | Nov. 5, 2018, 8:46 a.m. | OK | GNU C++14 | TESTS | 45 | 342 | 11878400 | 2000 | |
| 63995952 | gxucm | C | Nov. 1, 2019, 2:37 p.m. | OK | GNU C++17 | TESTS | 45 | 218 | 10854400 | 2000 | |
| 35844117 | WooDeND | C | March 2, 2018, 3:24 p.m. | OK | GNU C++17 | TESTS | 45 | 248 | 12800000 | 2000 | |
| 51556124 | ruo | C | March 20, 2019, 5:01 a.m. | OK | GNU C++17 | TESTS | 45 | 280 | 5939200 | 2000 | |
| 67968408 | Kuroni | C | Dec. 30, 2019, 2:07 p.m. | OK | GNU C++17 | TESTS | 45 | 280 | 6041600 | 2000 | |
| 47031070 | pranav_012 | C | Dec. 15, 2018, 9:50 a.m. | OK | GNU C++17 | TESTS | 45 | 342 | 6041600 | 2000 | |
| 51732817 | ...z3r0... | C | March 22, 2019, 10:40 p.m. | OK | GNU C++17 | TESTS | 45 | 342 | 6451200 | 2000 | |
| 55124672 | vyomkesh | C | June 5, 2019, 12:17 p.m. | OK | GNU C++17 | TESTS | 45 | 530 | 17510400 | 2000 | |
| 55124729 | vyomkesh | C | June 5, 2019, 12:19 p.m. | OK | GNU C++17 | TESTS | 45 | 560 | 17510400 | 2000 | |
| 42359884 | SoGood | C | Sept. 2, 2018, 11:13 a.m. | OK | GNU C++17 | TESTS | 45 | 560 | 28979200 | 2000 | |
| 68491744 | Phortox | C | Jan. 10, 2020, 11:57 a.m. | OK | GNU C++17 | TESTS | 45 | 686 | 45158400 | 2000 | |
| 58780163 | Dukkha | C | Aug. 13, 2019, 7:08 p.m. | OK | Java 8 | TESTS | 45 | 1308 | 0 | 2000 | |
| 44333183 | Evgeniy97 | C | Oct. 14, 2018, 7:31 p.m. | OK | Java 8 | TESTS | 45 | 1340 | 38809600 | 2000 | |
| 53490441 | teru | C | April 29, 2019, 8:14 a.m. | OK | Mono C# | TESTS | 45 | 966 | 37785600 | 2000 | |
| 36421203 | Schullz | C | March 19, 2018, 9:41 p.m. | OK | MS C++ | TESTS | 45 | 310 | 13721600 | 2000 | |
| 36411332 | Volpe | C | March 19, 2018, 1:16 p.m. | OK | MS C++ | TESTS | 45 | 810 | 10035200 | 2000 | |
| 43350772 | sergovoy | C | Sept. 24, 2018, 2:01 a.m. | OK | PyPy 3 | TESTS | 45 | 1838 | 57958400 | 2000 | |
| 35855948 | ______u______ | C | March 2, 2018, 8:11 p.m. | OK | Ruby | TESTS | 45 | 1932 | 33587200 | 2000 | |
| 35855895 | ______n______ | C | March 2, 2018, 8:09 p.m. | OK | Ruby | TESTS | 45 | 1932 | 33587200 | 2000 | |
| 35855424 | _____i_____ | C | March 2, 2018, 8:01 p.m. | OK | Ruby | TESTS | 45 | 1932 | 33587200 | 2000 | |
| 35855391 | _____k_____ | C | March 2, 2018, 8 p.m. | OK | Ruby | TESTS | 45 | 1932 | 33587200 | 2000 | |
| 35844278 | ______h______ | C | March 2, 2018, 3:27 p.m. | OK | Ruby | TESTS | 45 | 1932 | 33587200 | 2000 | |
| 35844141 | ______k______ | C | March 2, 2018, 3:24 p.m. | OK | Ruby | TESTS | 45 | 1932 | 33587200 | 2000 | |
| 35843851 | ______i______ | C | March 2, 2018, 3:19 p.m. | OK | Ruby | TESTS | 45 | 1932 | 33587200 | 2000 | |
| 35841644 | ______M______ | C | March 2, 2018, 2:38 p.m. | OK | Ruby | TESTS | 45 | 1932 | 33587200 | 2000 |
Back to search problems