Codeforces Round 898 (Div. 4)

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
1873 Codeforces Round 898 (Div. 4) FINISHED False 9000 41873063 Sept. 21, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7803 ) H Mad City PROGRAMMING dfs and similar ds graphs shortest paths

B'Marcel and Valeriu are in the mad city, which is represented by n buildings with n two-way roads between them. Marcel and Valeriu start at buildings a and b respectively. Marcel wants to catch Valeriu, in other words, be in the same building as him or meet on the same road. During each move, they choose to go to an adjacent building of their current one or stay in the same building. Because Valeriu knows Marcel so well, Valeriu can predict where Marcel will go in the next move. Valeriu can use this information to make his move. They start and end the move at the same time. It is guaranteed that any pair of buildings is connected by some path and there is at most one road between any pair of buildings. Assuming both players play optimally, answer if Valeriu has a strategy to indefinitely escape Marcel. The first line contains a single integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The first line of each test case contains three space-separated integers n , a , b ( 3 <= q n <= q 2 cdot 10^5 ; 1 <= q a, b <= q n ) -- the number of buildings (which equals the number of roads) and the starting buildings of Marcel and Valeriu. The following n lines each contain two integers u_i , v_i ( 1 <= u_i, v_i <= n , u_i neq v_i ) -- there is a road between buildings u_i and v_i . There is at most one road between any unordered pair of buildings. The sum of n over all test cases does not exceed 2 cdot 10^5 . The roads are given that it is possible to get from any building to any other building going along the roads. For each test case output "YES" if Valeriu can escape Marcel forever and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). In the first test case the graph looks as follows: In the second test case the graph looks as follows: '...

Tutorials

120634

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
224558217 ahmedafeef H Sept. 22, 2023, 4:56 a.m. OK GNU C11 TESTS 12 452 9625600
224561705 AtomFirst H Sept. 22, 2023, 5:36 a.m. OK GNU C++14 TESTS 12 109 13824000
224555764 kuguadawang H Sept. 22, 2023, 4:23 a.m. OK GNU C++14 TESTS 12 109 16691200
224544700 katarina001 H Sept. 22, 2023, 1:37 a.m. OK GNU C++14 TESTS 12 139 19968000
224560955 AForYet H Sept. 22, 2023, 5:28 a.m. OK GNU C++14 TESTS 12 139 20377600
224559893 luohanning H Sept. 22, 2023, 5:16 a.m. OK GNU C++14 TESTS 12 139 23449600
224555190 kartta080197 H Sept. 22, 2023, 4:14 a.m. OK GNU C++14 TESTS 12 140 22016000
224559814 luohanning H Sept. 22, 2023, 5:15 a.m. OK GNU C++14 TESTS 12 140 23449600
224533301 jainaditya8464 H Sept. 21, 2023, 9:16 p.m. OK GNU C++14 TESTS 12 140 25804800
224516672 shivPatil H Sept. 21, 2023, 6:10 p.m. OK GNU C++14 TESTS 12 140 25907200
224532629 Itadori_yuji_007 H Sept. 21, 2023, 9:04 p.m. OK GNU C++14 TESTS 12 140 26624000
224544369 _rubbish H Sept. 22, 2023, 1:31 a.m. OK GNU C++17 TESTS 12 93 17612800
224542931 Charming H Sept. 22, 2023, 1:04 a.m. OK GNU C++17 TESTS 12 93 21094400
224554688 ignorance2 H Sept. 22, 2023, 4:07 a.m. OK GNU C++17 TESTS 12 109 19251200
224554250 Colblue H Sept. 22, 2023, 4 a.m. OK GNU C++17 TESTS 12 124 15872000
224549294 wibulord H Sept. 22, 2023, 2:54 a.m. OK GNU C++17 TESTS 12 124 17203200
224519620 case_la H Sept. 21, 2023, 6:33 p.m. OK GNU C++17 TESTS 12 124 18636800
224559472 dadaxigua H Sept. 22, 2023, 5:12 a.m. OK GNU C++17 TESTS 12 139 6144000
224547881 Colblue H Sept. 22, 2023, 2:31 a.m. OK GNU C++17 TESTS 12 139 16076800
224533062 7dharsh H Sept. 21, 2023, 9:11 p.m. OK GNU C++17 TESTS 12 139 18636800
224538419 ihabawad18 H Sept. 21, 2023, 11:15 p.m. OK GNU C++17 TESTS 12 139 23347200
224559264 yangjl H Sept. 22, 2023, 5:09 a.m. OK GNU C++17 (64) TESTS 12 108 46387200
224559540 yangjl H Sept. 22, 2023, 5:12 a.m. OK GNU C++17 (64) TESTS 12 108 48025600
224547459 FLOWPOWER H Sept. 22, 2023, 2:24 a.m. OK GNU C++17 (64) TESTS 12 124 33382400
224546358 Cosysl H Sept. 22, 2023, 2:06 a.m. OK GNU C++17 (64) TESTS 12 139 51404800
224517812 Fighter_sky H Sept. 21, 2023, 6:19 p.m. OK GNU C++17 (64) TESTS 12 140 23552000
224550527 Ackhava H Sept. 22, 2023, 3:13 a.m. OK GNU C++17 (64) TESTS 12 140 28467200
224523107 Hostek H Sept. 21, 2023, 7:06 p.m. OK GNU C++17 (64) TESTS 12 140 34816000
224554375 Domination_Devil H Sept. 22, 2023, 4:02 a.m. OK GNU C++17 (64) TESTS 12 140 35225600
224544249 wangjunchao H Sept. 22, 2023, 1:30 a.m. OK GNU C++17 (64) TESTS 12 140 36761600
224545861 MrPerson H Sept. 22, 2023, 1:59 a.m. OK GNU C++17 (64) TESTS 12 140 48332800
224550946 ha_na_da H Sept. 22, 2023, 3:19 a.m. OK GNU C++20 (64) TESTS 12 62 7065600
224558058 W921106840130 H Sept. 22, 2023, 4:54 a.m. OK GNU C++20 (64) TESTS 12 77 61952000
224557199 noya2 H Sept. 22, 2023, 4:43 a.m. OK GNU C++20 (64) TESTS 12 93 36864000
224534509 MOHIR_MBSTU H Sept. 21, 2023, 9:37 p.m. OK GNU C++20 (64) TESTS 12 108 18329600
224544082 CarlosS48 H Sept. 22, 2023, 1:27 a.m. OK GNU C++20 (64) TESTS 12 108 32358400
224518281 anttoh H Sept. 21, 2023, 6:23 p.m. OK GNU C++20 (64) TESTS 12 109 12083200
224550910 i_emerge16 H Sept. 22, 2023, 3:18 a.m. OK GNU C++20 (64) TESTS 12 109 15974400
224534438 biank H Sept. 21, 2023, 9:36 p.m. OK GNU C++20 (64) TESTS 12 109 28057600
224551777 jzhsh1735 H Sept. 22, 2023, 3:31 a.m. OK GNU C++20 (64) TESTS 12 109 30515200
224545686 tllwtg H Sept. 22, 2023, 1:56 a.m. OK GNU C++20 (64) TESTS 12 109 32870400
224524002 kushwaha_vi H Sept. 21, 2023, 7:15 p.m. OK Java 11 TESTS 12 670 43212800
224534106 dark_rays H Sept. 21, 2023, 9:30 p.m. OK Java 11 TESTS 12 686 88780800
224538162 Eslam_Ahmed H Sept. 21, 2023, 11:08 p.m. OK Java 11 TESTS 12 920 103116800
224528734 JordanPoole H Sept. 21, 2023, 8:09 p.m. OK Java 11 TESTS 12 1294 91852800
224545688 ImSoCrazy H Sept. 22, 2023, 1:56 a.m. OK Java 11 TESTS 12 1543 118681600
224538509 dzhi H Sept. 21, 2023, 11:18 p.m. OK Java 17 TESTS 12 592 41676800
224554134 starhao H Sept. 22, 2023, 3:58 a.m. OK Java 17 TESTS 12 841 36454400
224554395 starhao H Sept. 22, 2023, 4:02 a.m. OK Java 17 TESTS 12 920 35635200
224559501 ikun111 H Sept. 22, 2023, 5:12 a.m. OK Java 17 TESTS 12 1091 43724800
224549908 Zhanzhe_Lee H Sept. 22, 2023, 3:04 a.m. OK Java 8 TESTS 12 514 44646400
224519792 vijay_panwar12 H Sept. 21, 2023, 6:34 p.m. OK Java 8 TESTS 12 608 48844800
224538045 Eslam_Ahmed H Sept. 21, 2023, 11:04 p.m. OK Java 8 TESTS 12 935 75468800
224553237 Sri_ram_Prasad_01 H Sept. 22, 2023, 3:51 a.m. OK Java 8 TESTS 12 998 92364800
224553024 Danger_Don H Sept. 22, 2023, 3:50 a.m. OK Java 8 TESTS 12 1248 206643200
224549262 YMSeah H Sept. 22, 2023, 2:53 a.m. OK PyPy 3 TESTS 12 499 75468800
224519396 ikhare H Sept. 21, 2023, 6:31 p.m. OK PyPy 3 TESTS 12 780 91340800
224519102 Bleeding_steel H Sept. 21, 2023, 6:29 p.m. OK PyPy 3 TESTS 12 794 38502400
224530348 sleepingonee H Sept. 21, 2023, 8:29 p.m. OK PyPy 3-64 TESTS 12 358 51200000
224516451 sleepingonee H Sept. 21, 2023, 6:08 p.m. OK PyPy 3-64 TESTS 12 373 45875200
224561148 MenaceJn H Sept. 22, 2023, 5:30 a.m. OK PyPy 3-64 TESTS 12 405 41676800
224563919 groundtruth H Sept. 22, 2023, 5:59 a.m. OK PyPy 3-64 TESTS 12 451 37376000
224542061 RobinFromTheHood H Sept. 22, 2023, 12:47 a.m. OK PyPy 3-64 TESTS 12 468 40550400
224547952 JinYuManTang H Sept. 22, 2023, 2:32 a.m. OK PyPy 3-64 TESTS 12 545 49561600
224548690 KAMITO H Sept. 22, 2023, 2:45 a.m. OK PyPy 3-64 TESTS 12 670 47718400
224556972 gardengnome H Sept. 22, 2023, 4:40 a.m. OK PyPy 3-64 TESTS 12 935 49766400
224538057 Quick-One H Sept. 21, 2023, 11:04 p.m. OK PyPy 3-64 TESTS 12 982 152473600
224523696 arT_ H Sept. 21, 2023, 7:12 p.m. OK PyPy 3-64 TESTS 12 1123 71372800
224525940 arhiza H Sept. 21, 2023, 7:37 p.m. OK Python 3 TESTS 12 950 42700800
224519667 YIVI H Sept. 21, 2023, 6:33 p.m. OK Python 3 TESTS 12 1123 126668800
224532367 aayush_chhabra H Sept. 21, 2023, 8:59 p.m. OK Python 3 TESTS 12 1746 165171200

remove filters

Back to search problems