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 |
---|---|---|---|---|---|---|
1994 | Codeforces Round 959 sponsored by NEAR (Div. 1 + Div. 2) | FINISHED | False | 7200 | 15866663 | July 18, 2024, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1253 ) | F | Stardew Valley | PROGRAMMING | constructive algorithms dfs and similar graphs |
B'Pelican Town represents n houses connected by m bidirectional roads. Some roads have NPCs standing on them. Farmer Buba needs to walk on each road with an NPC and talk to them. Help the farmer find a route satisfying the following properties: It is guaranteed that you can reach any house from any other by walking on the roads with NPCs only. Each test consists of multiple test cases. The first line contains an integer t ( 1 <= t <= 10^{4} ) -- the number of test cases. Then follows the description of the test cases. The first line of each test case contains two integers n and m ( 2 <= q n <= q 5 cdot 10^5, 1 <= q m <= q 5 cdot 10^5 ) -- the number of houses and roads in Pelican Town respectively. In each of the next m lines, three integers u , v , and c ( 1 <= q u, v <= q n, c = 0/1 ) are given -- the ends of the road and whether an NPC is on this road. If c = 1 , then the road has an NPC. If c = 0 , then the road has no NPC. The graph may contain multiple edges and loops, and if there are multiple edges with NPCs standing on them, the route must follow each of these roads. It is guaranteed that you can reach any house from any other by walking on the roads with NPCs only. It is guaranteed that the sum of n and m for all test cases does not exceed 5 cdot 10^5 . For each test case, if there is no solution, then output "No" (without quotes). Otherwise, output "Yes" (without quotes), and then output k -- the number of roads in the route. In the next line, output k + 1 numbers -- the houses of the route in the order of traversal. Note that the first house should match the last one, as the route is cyclic. If there are multiple answers, you can print any of them. You can output each letter in any case (for example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as a positive answer). Note that in the third test case, there are m'... |
Video Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
271262831 | Imot | F | July 18, 2024, 4:32 p.m. | OK | C++14 (GCC 6-32) | TESTS | 80 | 452 | 84787200 | ||
271313454 | Felix72 | F | July 19, 2024, 3:01 a.m. | OK | C++14 (GCC 6-32) | TESTS | 85 | 562 | 33996800 | ||
271256919 | OInfly | F | July 18, 2024, 4:17 p.m. | OK | C++14 (GCC 6-32) | TESTS | 80 | 562 | 39526400 | ||
271308760 | ImmortaLimit | F | July 19, 2024, 2:13 a.m. | OK | C++14 (GCC 6-32) | TESTS | 85 | 593 | 53964800 | ||
271255117 | Meatherm | F | July 18, 2024, 4:12 p.m. | OK | C++14 (GCC 6-32) | TESTS | 80 | 671 | 108544000 | ||
271311810 | Ssoul | F | July 19, 2024, 2:46 a.m. | OK | C++14 (GCC 6-32) | TESTS | 85 | 702 | 253849600 | ||
271255120 | Nityacke | F | July 18, 2024, 4:12 p.m. | OK | C++14 (GCC 6-32) | TESTS | 80 | 858 | 93798400 | ||
271268584 | llzer | F | July 18, 2024, 5:28 p.m. | OK | C++14 (GCC 6-32) | TESTS | 80 | 859 | 43827200 | ||
271306343 | dingduangdou | F | July 19, 2024, 1:45 a.m. | OK | C++14 (GCC 6-32) | TESTS | 85 | 967 | 47001600 | ||
271263643 | heaksicn | F | July 18, 2024, 4:34 p.m. | OK | C++14 (GCC 6-32) | TESTS | 80 | 1327 | 56217600 | ||
271280026 | GoogleBot | F | July 18, 2024, 7:02 p.m. | OK | C++17 (GCC 7-32) | TESTS | 81 | 453 | 63692800 | ||
271280125 | GoogleBot | F | July 18, 2024, 7:03 p.m. | OK | C++17 (GCC 7-32) | TESTS | 81 | 499 | 49766400 | ||
271308555 | Sparkle_Twilight | F | July 19, 2024, 2:11 a.m. | OK | C++17 (GCC 7-32) | TESTS | 85 | 546 | 79257600 | ||
271308488 | guoxiangyu | F | July 19, 2024, 2:10 a.m. | OK | C++17 (GCC 7-32) | TESTS | 85 | 546 | 79257600 | ||
271279194 | pixelpilgrims | F | July 18, 2024, 6:54 p.m. | OK | C++17 (GCC 7-32) | TESTS | 81 | 562 | 47513600 | ||
271315122 | q1w2e3r4_1 | F | July 19, 2024, 3:18 a.m. | OK | C++17 (GCC 7-32) | TESTS | 85 | 592 | 52838400 | ||
271299821 | gyouzasushi | F | July 19, 2024, 12:09 a.m. | OK | C++17 (GCC 7-32) | TESTS | 85 | 624 | 40857600 | ||
271262485 | Mio846845 | F | July 18, 2024, 4:31 p.m. | OK | C++17 (GCC 7-32) | TESTS | 80 | 624 | 43315200 | ||
271261856 | Muelsyse | F | July 18, 2024, 4:30 p.m. | OK | C++17 (GCC 7-32) | TESTS | 80 | 655 | 22528000 | ||
271299927 | gyouzasushi | F | July 19, 2024, 12:10 a.m. | OK | C++17 (GCC 7-32) | TESTS | 85 | 655 | 40652800 | ||
271257049 | maspy | F | July 18, 2024, 4:17 p.m. | OK | C++20 (GCC 13-64) | TESTS | 80 | 233 | 55296000 | ||
271268991 | LOOP0 | F | July 18, 2024, 5:30 p.m. | OK | C++20 (GCC 13-64) | TESTS | 80 | 296 | 82227200 | ||
271303478 | Imakf | F | July 19, 2024, 1:10 a.m. | OK | C++20 (GCC 13-64) | TESTS | 85 | 389 | 104755200 | ||
271305845 | rqoi031 | F | July 19, 2024, 1:39 a.m. | OK | C++20 (GCC 13-64) | TESTS | 85 | 390 | 70451200 | ||
271260585 | Mtaylor | F | July 18, 2024, 4:27 p.m. | OK | C++20 (GCC 13-64) | TESTS | 80 | 390 | 82022400 | ||
271326859 | ebi_fly | F | July 19, 2024, 5:28 a.m. | OK | C++20 (GCC 13-64) | TESTS | 85 | 390 | 128204800 | ||
271312698 | ian_HLX | F | July 19, 2024, 2:54 a.m. | OK | C++20 (GCC 13-64) | TESTS | 85 | 405 | 62976000 | ||
271309668 | fyable | F | July 19, 2024, 2:24 a.m. | OK | C++20 (GCC 13-64) | TESTS | 85 | 405 | 124416000 | ||
271256416 | thecold | F | July 18, 2024, 4:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 80 | 436 | 76288000 | ||
271310178 | fyable | F | July 19, 2024, 2:29 a.m. | OK | C++20 (GCC 13-64) | TESTS | 85 | 436 | 112332800 | ||
271257413 | KumaTachiRen | F | July 18, 2024, 4:18 p.m. | OK | C# 8 | TESTS | 80 | 812 | 98099200 | ||
271280724 | misorin | F | July 18, 2024, 7:10 p.m. | OK | PyPy 3-64 | TESTS | 81 | 405 | 75468800 | ||
271327153 | Little_Sheep_Yawn | F | July 19, 2024, 5:32 a.m. | OK | PyPy 3-64 | TESTS | 85 | 749 | 80588800 | ||
271313772 | shotoyoo | F | July 19, 2024, 3:04 a.m. | OK | PyPy 3-64 | TESTS | 85 | 1812 | 178688000 | ||
271261458 | vwxyz0 | F | July 18, 2024, 4:29 p.m. | OK | PyPy 3-64 | TESTS | 80 | 1936 | 167116800 | ||
271255037 | tassei903 | F | July 18, 2024, 4:12 p.m. | OK | PyPy 3-64 | TESTS | 80 | 1968 | 198553600 |
Back to search problems