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 |
---|---|---|---|---|---|---|
1007 | Codeforces Round 497 (Div. 1) | FINISHED | False | 7800 | 206033124 | July 13, 2018, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 293 ) | D | Ants | PROGRAMMING | 2-sat data structures trees | 3200 |
B'There is a tree with n vertices. There are also m ants living on it. Each ant has its own color. The i -th ant has two favorite pairs of vertices: ( a_i, b_i ) and ( c_i, d_i ). You need to tell if it is possible to paint the edges of the tree in m colors so that every ant will be able to walk between vertices from one of its favorite pairs using only edges of his color; if it is possible, you need to print which pair every ant should use. The first line contains a single integer n ( 2 <= q n <= q 10^5 ) -- the number of vertices. Each of the next n-1 lines contains two integers u_i and v_i ( 1 <= q u_i, v_i <= q n ), meaning that there is an edge between vertices u_i and v_i . The next line contains a single integer m ( 1 <= q m <= q 10^4 ) -- the number of ants. Each of the next m lines contains four integers a_i , b_i , c_i , and d_i ( 1 <= q a_i, b_i, c_i, d_i <= q n , a_i neq b_i, c_i neq d_i ), meaning that pairs ( a_i , b_i ) and ( c_i , d_i ) are favorite for the i -th ant. Print "NO" (without quotes) if the wanted painting is impossible. Otherwise, print "YES" (without quotes). Print m lines. On the i -th line, print 1 if the i -th ant will use the first pair and 2 otherwise. If there are multiple answers, print any. In the sample, the second and the third edge should be painted in the first color, the first and the fifth should be painted in the second color, and the fourth should be painted in the third color. '... |
Editorial for Codeforces Round #497 by Skyglow |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
41423642 | Renaissanceharry | D | Aug. 10, 2018, 8:14 a.m. | OK | GNU C++ | TESTS | 78 | 389 | 177766400 | 3200 | |
40334916 | Nemirexx | D | July 14, 2018, 3:26 p.m. | OK | GNU C++ | TESTS | 78 | 389 | 177766400 | 3200 | |
53993278 | HiOkami | D | May 11, 2019, 1:17 p.m. | OK | GNU C++11 | TESTS | 78 | 233 | 183603200 | 3200 | |
53992313 | HiOkami | D | May 11, 2019, 12:52 p.m. | OK | GNU C++11 | TESTS | 78 | 233 | 184217600 | 3200 | |
53993254 | HiOkami | D | May 11, 2019, 1:16 p.m. | OK | GNU C++11 | TESTS | 78 | 234 | 183603200 | 3200 | |
50537843 | hdhd | D | Feb. 26, 2019, 4:35 p.m. | OK | GNU C++11 | TESTS | 78 | 249 | 327782400 | 3200 | |
44105684 | zyding | D | Oct. 11, 2018, 9:06 a.m. | OK | GNU C++11 | TESTS | 78 | 249 | 677171200 | 3200 | |
50537906 | hdhd | D | Feb. 26, 2019, 4:37 p.m. | OK | GNU C++11 | TESTS | 78 | 264 | 306278400 | 3200 | |
40287759 | wxh010910 | D | July 13, 2018, 4:11 p.m. | OK | GNU C++11 | TESTS | 78 | 265 | 26726400 | 3200 | |
66615804 | luogu_bot3 | D | Dec. 11, 2019, 3:44 a.m. | OK | GNU C++11 | TESTS | 78 | 295 | 394035200 | 3200 | |
66615760 | MoQianXue | D | Dec. 11, 2019, 3:41 a.m. | OK | GNU C++11 | TESTS | 78 | 295 | 394035200 | 3200 | |
47247116 | 1592063346 | D | Dec. 19, 2018, 6:26 a.m. | OK | GNU C++11 | TESTS | 78 | 389 | 217395200 | 3200 | |
50685743 | Newusers | D | March 2, 2019, 1:35 p.m. | OK | GNU C++14 | TESTS | 78 | 217 | 310374400 | 3200 | |
40520207 | krijgertje | D | July 18, 2018, 3:41 p.m. | OK | GNU C++14 | TESTS | 78 | 265 | 28262400 | 3200 | |
40525607 | krijgertje | D | July 18, 2018, 8:13 p.m. | OK | GNU C++14 | TESTS | 78 | 280 | 39219200 | 3200 | |
41623820 | consecutivelimit | D | Aug. 15, 2018, 1:16 p.m. | OK | GNU C++14 | TESTS | 78 | 327 | 105574400 | 3200 | |
54432286 | haj_lemon | D | May 21, 2019, 1:18 a.m. | OK | GNU C++14 | TESTS | 78 | 327 | 297574400 | 3200 | |
40525546 | krijgertje | D | July 18, 2018, 8:10 p.m. | OK | GNU C++14 | TESTS | 78 | 373 | 47308800 | 3200 | |
42746234 | ecnerwala | D | Sept. 10, 2018, 7:28 p.m. | OK | GNU C++14 | TESTS | 78 | 389 | 102195200 | 3200 | |
40530782 | rxdoi | D | July 19, 2018, 2:33 a.m. | OK | GNU C++14 | TESTS | 78 | 389 | 590336000 | 3200 | |
40492131 | krijgertje | D | July 17, 2018, 9:51 p.m. | OK | GNU C++14 | TESTS | 78 | 405 | 30208000 | 3200 | |
40304307 | consecutivelimit | D | July 14, 2018, 4:44 a.m. | OK | GNU C++14 | TESTS | 78 | 436 | 177971200 | 3200 | |
42755818 | neal | D | Sept. 11, 2018, 6:59 a.m. | OK | GNU C++17 | TESTS | 78 | 343 | 78028800 | 3200 | |
53004356 | mayaohua2003 | D | April 19, 2019, 8:49 a.m. | OK | GNU C++17 | TESTS | 78 | 358 | 192307200 | 3200 | |
60653327 | neal | D | Sept. 15, 2019, 8:44 p.m. | OK | GNU C++17 | TESTS | 78 | 451 | 142233600 | 3200 | |
60595859 | neal | D | Sept. 15, 2019, 5:33 a.m. | OK | GNU C++17 | TESTS | 78 | 451 | 142233600 | 3200 | |
52223128 | jinjonik | D | April 2, 2019, 7:47 a.m. | OK | GNU C++17 | TESTS | 78 | 467 | 26828800 | 3200 | |
42755998 | neal | D | Sept. 11, 2018, 7:07 a.m. | OK | GNU C++17 | TESTS | 78 | 498 | 142336000 | 3200 | |
42755912 | neal | D | Sept. 11, 2018, 7:03 a.m. | OK | GNU C++17 | TESTS | 78 | 514 | 142233600 | 3200 | |
42750625 | neal | D | Sept. 11, 2018, 1:25 a.m. | OK | GNU C++17 | TESTS | 78 | 514 | 142233600 | 3200 | |
40388837 | Ali_Pi | D | July 15, 2018, 9:18 p.m. | OK | GNU C++17 | TESTS | 78 | 529 | 26931200 | 3200 | |
42755267 | neal | D | Sept. 11, 2018, 6:29 a.m. | OK | GNU C++17 | TESTS | 78 | 545 | 142233600 | 3200 |
Back to search problems