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 |
|---|---|---|---|---|---|---|
| 2065 | Codeforces Round 1003 (Div. 4) | FINISHED | False | 8100 | 37293922 | Feb. 9, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 7049 ) | F | Skibidus and Slay | PROGRAMMING | data structures dfs and similar graphs greedy trees |
Let's define the majority of a sequence of (k) elements as the unique value that appears strictly more than (\left \lfloor {\frac{k}{2}} \right \rfloor) times. If such a value does not exist, then the sequence does not have a majority. For example, the sequence (1,3,2,3,3) has a majority (3) because it appears (3 > \left \lfloor {\frac{5}{2}} \right \rfloor = 2) times, but (1,2,3,4,5) and (1,3,2,3,4) do not have a majority. Skibidus found a tree(^{\text{∗}}) of (n) vertices and an array (a) of length (n). Vertex (i) has the value (a_i) written on it, where (a_i) is an integer in the range (1, n). For each (i) from (1) to (n), please determine if there exists a non-trivial simple path(^{\text{†}}) such that (i) is the majority of the sequence of integers written on the vertices that form the path. (^{\text{∗}})A tree is a connected graph without cycles. (^{\text{†}})A sequence of vertices (v_1, v_2, ..., v_m) ((m \geq 2)) forms a non-trivial simple path if (v_i) and (v_{i+1}) are connected by an edge for all (1 \leq i \leq m - 1) and all (v_i) are pairwise distinct. Note that the path must consist of at least (2) vertices. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((2 \le n \le 5 \cdot 10^5)) — the number of vertices. The second line of each test case contains (a_1,a_2,\ldots,a_n) ((1 \le a_i \le n)) — the integers written on the vertices. Each of the next (n-1) lines contains two integers (u_i) and (v_i), denoting the two vertices connected by an edge ((1 \le u_i,v_i \le n), (u_i \neq v_i)). It is guaranteed that the given edges form a tree. It is guaranteed that the sum of (n) over all test cases does not excee |
| Video Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 305376005 | MapacheTactico | F | Feb. 9, 2025, 8:58 p.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 624 | 16793600 | ||
| 305372982 | JOliva | F | Feb. 9, 2025, 8:16 p.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 640 | 16588800 | ||
| 305372228 | khaled_eg | F | Feb. 9, 2025, 8:07 p.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 640 | 16588800 | ||
| 305372684 | khaled_eg | F | Feb. 9, 2025, 8:12 p.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 671 | 16793600 | ||
| 305360025 | aviralhatwal | F | Feb. 9, 2025, 6:20 p.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 671 | 18534400 | ||
| 305379486 | Vincente23 | F | Feb. 9, 2025, 9:53 p.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 671 | 19251200 | ||
| 305397256 | FordMerding | F | Feb. 10, 2025, 3:21 a.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 702 | 23142400 | ||
| 305357874 | _GobLin_ | F | Feb. 9, 2025, 6:05 p.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 718 | 18739200 | ||
| 305356432 | sth_2108 | F | Feb. 9, 2025, 5:56 p.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 718 | 18944000 | ||
| 305410859 | liza_del_sierra | F | Feb. 10, 2025, 5:41 a.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 733 | 18739200 | ||
| 305406741 | Spaseeker | F | Feb. 10, 2025, 5:07 a.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 468 | 13004800 | ||
| 305361901 | use_kar | F | Feb. 9, 2025, 6:33 p.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 562 | 25395200 | ||
| 305381887 | LLGM | F | Feb. 9, 2025, 10:42 p.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 593 | 25497600 | ||
| 305378550 | Ladamalina | F | Feb. 9, 2025, 9:36 p.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 593 | 27648000 | ||
| 305387156 | leo_rc | F | Feb. 10, 2025, 12:49 a.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 608 | 26931200 | ||
| 305404303 | juruo_stl | F | Feb. 10, 2025, 4:41 a.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 609 | 25088000 | ||
| 305384767 | MournInk | F | Feb. 9, 2025, 11:55 p.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 609 | 33894400 | ||
| 305399883 | value0 | F | Feb. 10, 2025, 3:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 624 | 35123200 | ||
| 305378446 | mangler | F | Feb. 9, 2025, 9:35 p.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 624 | 37683200 | ||
| 305374196 | doola | F | Feb. 9, 2025, 8:32 p.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 624 | 81920000 | ||
| 305384723 | KM_Parvez | F | Feb. 9, 2025, 11:54 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 530 | 26316800 | ||
| 305406213 | duker_ki | F | Feb. 10, 2025, 5:02 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 562 | 38092800 | ||
| 305370280 | bera_474 | F | Feb. 9, 2025, 7:46 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 577 | 25292800 | ||
| 305370183 | don_2004 | F | Feb. 9, 2025, 7:45 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 577 | 25292800 | ||
| 305398310 | YouKnowNothing_JonSnow | F | Feb. 10, 2025, 3:35 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 577 | 25395200 | ||
| 305365553 | Souture | F | Feb. 9, 2025, 7:02 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 608 | 27443200 | ||
| 305398609 | zhaohongdi114514 | F | Feb. 10, 2025, 3:40 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 624 | 24985600 | ||
| 305403945 | CodderPrince | F | Feb. 10, 2025, 4:38 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 624 | 25395200 | ||
| 305371168 | MIDORIYA_ | F | Feb. 9, 2025, 7:55 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 624 | 27443200 | ||
| 305355455 | WaveBreaker | F | Feb. 9, 2025, 5:49 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 624 | 33792000 | ||
| 305396317 | Harsh-123 | F | Feb. 10, 2025, 3:09 a.m. | OK | Java 21 | TESTS | 19 | 1999 | 204288000 | ||
| 305355876 | lscratchm | F | Feb. 9, 2025, 5:52 p.m. | OK | Java 21 | TESTS | 19 | 2343 | 211763200 | ||
| 305372926 | polsage | F | Feb. 9, 2025, 8:15 p.m. | OK | Java 21 | TESTS | 19 | 3015 | 295424000 | ||
| 305378996 | polsage | F | Feb. 9, 2025, 9:44 p.m. | OK | Java 21 | TESTS | 19 | 3030 | 296550400 | ||
| 305397558 | Harsh-123 | F | Feb. 10, 2025, 3:25 a.m. | OK | Java 21 | TESTS | 19 | 3234 | 380518400 | ||
| 305390481 | NerfThis | F | Feb. 10, 2025, 1:49 a.m. | OK | Java 8 | TESTS | 19 | 827 | 32665600 | ||
| 305365387 | kasiru_69 | F | Feb. 9, 2025, 7:01 p.m. | OK | Java 8 | TESTS | 19 | 3749 | 103731200 | ||
| 305360835 | gardengnome | F | Feb. 9, 2025, 6:26 p.m. | OK | PyPy 3-64 | TESTS | 19 | 936 | 80588800 | ||
| 305397587 | Nelperrok3 | F | Feb. 10, 2025, 3:25 a.m. | OK | PyPy 3-64 | TESTS | 19 | 1218 | 220262400 | ||
| 305375794 | Yigerem | F | Feb. 9, 2025, 8:55 p.m. | OK | PyPy 3-64 | TESTS | 19 | 1249 | 118272000 | ||
| 305367067 | Msol | F | Feb. 9, 2025, 7:14 p.m. | OK | PyPy 3-64 | TESTS | 19 | 1328 | 175616000 | ||
| 305354993 | DeadMan69 | F | Feb. 9, 2025, 5:46 p.m. | OK | PyPy 3-64 | TESTS | 19 | 1390 | 175923200 | ||
| 305358832 | anna_yang | F | Feb. 9, 2025, 6:12 p.m. | OK | PyPy 3-64 | TESTS | 19 | 1484 | 265523200 | ||
| 305362430 | hxrshh | F | Feb. 9, 2025, 6:37 p.m. | OK | PyPy 3-64 | TESTS | 19 | 1546 | 126361600 | ||
| 305369348 | mooIi | F | Feb. 9, 2025, 7:37 p.m. | OK | PyPy 3-64 | TESTS | 19 | 1578 | 119091200 | ||
| 305359151 | anna_yang | F | Feb. 9, 2025, 6:14 p.m. | OK | PyPy 3-64 | TESTS | 19 | 1640 | 265932800 | ||
| 305373804 | jayasurya-n | F | Feb. 9, 2025, 8:27 p.m. | OK | PyPy 3-64 | TESTS | 19 | 1734 | 109568000 | ||
| 305388429 | snehalka | F | Feb. 10, 2025, 1:14 a.m. | OK | Python 2 | TESTS | 19 | 2953 | 144588800 | ||
| 305379874 | Mehran_usb | F | Feb. 9, 2025, 10 p.m. | OK | Python 3 | TESTS | 19 | 2093 | 130560000 | ||
| 305375807 | ag_klindyuk | F | Feb. 9, 2025, 8:55 p.m. | OK | Python 3 | TESTS | 19 | 2671 | 202854400 | ||
| 305368524 | kalinov | F | Feb. 9, 2025, 7:29 p.m. | OK | Rust 2021 | TESTS | 19 | 624 | 124825600 |
Back to search problems