Codeforces Round 798 (Div. 2)

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
1689 Codeforces Round 798 (Div. 2) FINISHED False 7200 82301063 June 10, 2022, 4:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 11568 ) C Infected Tree PROGRAMMING constructive algorithms dfs and similar dp greedy trees

B"Byteland is a beautiful land known because of its beautiful trees. Misha has found a binary tree with n vertices, numbered from 1 to n . A binary tree is an acyclic connected bidirectional graph containing n vertices and n - 1 edges. Each vertex has a degree at most 3 , whereas the root is the vertex with the number 1 and it has a degree at most 2 . Unfortunately, the root got infected. The following process happens n times: As Misha does not have much time to think, please tell him what is the maximum number of vertices he can save from the infection (note that deleted vertices are not counted as saved). There are several test cases in the input data. The first line contains a single integer t ( 1 <= q t <= q 5000 ) -- the number of test cases. This is followed by the test cases description. The first line of each test case contains one integer n ( 2 <= q n <= q 3 cdot 10^5 ) -- the number of vertices of the tree. The i -th of the following n-1 lines in the test case contains two positive integers u_i and v_i ( 1 <= q u_i, v_i <= q n ), meaning that there exists an edge between them in the graph. It is guaranteed that the graph is a binary tree rooted at 1 . It is also guaranteed that the sum of n over all test cases won't exceed 3 cdot 10^5 . For each test case, output the maximum number of vertices Misha can save. In the first test case, the only possible action is to delete vertex 2 , after which we save 0 vertices in total. In the second test case, if we delete vertex 2 , we can save vertices 3 and 4 . "...

Tutorials

Editorial for Codeforces Round #798 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
160142547 YOK C June 10, 2022, 7:47 p.m. OK GNU C11 TESTS 30 124 8704000
160134253 2018339901318 C June 10, 2022, 6:31 p.m. OK GNU C++14 TESTS 30 202 13414400
160142688 fexla C June 10, 2022, 7:49 p.m. OK GNU C++14 TESTS 30 202 27238400
160161997 kundusuraj06 C June 11, 2022, 5:02 a.m. OK GNU C++14 TESTS 30 217 12083200
160158706 std_noob C June 11, 2022, 4 a.m. OK GNU C++14 TESTS 30 218 29593600
160157132 Timrss C June 11, 2022, 3:23 a.m. OK GNU C++14 TESTS 30 234 20172800
160163937 leaps C June 11, 2022, 5:31 a.m. OK GNU C++14 TESTS 30 234 24985600
160126317 MelikShah C June 10, 2022, 6:05 p.m. OK GNU C++14 TESTS 30 249 20172800
160146984 SuperJ6 C June 10, 2022, 9:10 p.m. OK GNU C++14 TESTS 30 249 20172800
160150295 snakefoot C June 10, 2022, 11:04 p.m. OK GNU C++14 TESTS 30 249 20480000
160138290 Keshav_Rajput C June 10, 2022, 7:04 p.m. OK GNU C++14 TESTS 30 249 20992000
160156432 dargoncat C June 11, 2022, 3:06 a.m. OK GNU C++17 TESTS 30 171 27443200
160160238 hahatang2004 C June 11, 2022, 4:31 a.m. OK GNU C++17 TESTS 30 187 26009600
160160146 hahatang2004 C June 11, 2022, 4:29 a.m. OK GNU C++17 TESTS 30 187 31641600
160160197 hahatang2004 C June 11, 2022, 4:30 a.m. OK GNU C++17 TESTS 30 202 30208000
160160095 hahatang2004 C June 11, 2022, 4:28 a.m. OK GNU C++17 TESTS 30 202 31641600
160138235 Beabled C June 10, 2022, 7:04 p.m. OK GNU C++17 TESTS 30 218 10035200
160160130 suraj_kush C June 11, 2022, 4:29 a.m. OK GNU C++17 TESTS 30 218 11264000
160141745 shakib59 C June 10, 2022, 7:37 p.m. OK GNU C++17 TESTS 30 218 15667200
160142037 andres_aliendre C June 10, 2022, 7:40 p.m. OK GNU C++17 TESTS 30 218 19046400
160127321 rurixx C June 10, 2022, 6:08 p.m. OK GNU C++17 TESTS 30 233 6348800
160157972 thu_lecore C June 11, 2022, 3:45 a.m. OK GNU C++17 (64) TESTS 30 171 39116800
160157422 jiajieshi C June 11, 2022, 3:30 a.m. OK GNU C++17 (64) TESTS 30 171 46694400
160159046 shencheng_ C June 11, 2022, 4:08 a.m. OK GNU C++17 (64) TESTS 30 186 40755200
160158867 CartesianTree C June 11, 2022, 4:04 a.m. OK GNU C++17 (64) TESTS 30 186 64102400
160152972 GaLz C June 11, 2022, 1:19 a.m. OK GNU C++17 (64) TESTS 30 202 27340800
160147261 Bobocan C June 10, 2022, 9:16 p.m. OK GNU C++17 (64) TESTS 30 202 43520000
160131538 TranGiaHuyWillWinIOI2023 C June 10, 2022, 6:23 p.m. OK GNU C++17 (64) TESTS 30 233 27340800
160152300 Thebestofthebest C June 11, 2022, 12:50 a.m. OK GNU C++17 (64) TESTS 30 233 29798400
160157784 jb_2402 C June 11, 2022, 3:39 a.m. OK GNU C++17 (64) TESTS 30 233 31129600
160156112 PCC C June 11, 2022, 2:58 a.m. OK GNU C++17 (64) TESTS 30 233 32153600
160151863 _Faisal101_ C June 11, 2022, 12:26 a.m. OK GNU C++20 (64) TESTS 30 202 22323200
160144348 kovaxis C June 10, 2022, 8:15 p.m. OK GNU C++20 (64) TESTS 30 202 27340800
160161482 nor C June 11, 2022, 4:54 a.m. OK GNU C++20 (64) TESTS 30 202 28979200
160149938 AzizFr C June 10, 2022, 10:47 p.m. OK GNU C++20 (64) TESTS 30 202 30003200
160155726 aufannn C June 11, 2022, 2:49 a.m. OK GNU C++20 (64) TESTS 30 202 31334400
160149293 LamaSalah C June 10, 2022, 10:21 p.m. OK GNU C++20 (64) TESTS 30 202 34611200
160153358 ttklwxx C June 11, 2022, 1:33 a.m. OK GNU C++20 (64) TESTS 30 202 43929600
160148941 try_target C June 10, 2022, 10:08 p.m. OK GNU C++20 (64) TESTS 30 217 29696000
160142340 noomaK C June 10, 2022, 7:44 p.m. OK GNU C++20 (64) TESTS 30 217 36966400
160153608 a_fan_of_cherish C June 11, 2022, 1:42 a.m. OK GNU C++20 (64) TESTS 30 218 20377600
160126082 MrOtter C June 10, 2022, 6:04 p.m. OK Java 11 TESTS 30 529 23756800
160140138 dunkingdonuts C June 10, 2022, 7:19 p.m. OK Java 11 TESTS 30 701 57446400
160156775 C_nena_E C June 11, 2022, 3:14 a.m. OK Java 11 TESTS 30 842 165990400
160158449 tech_ghost C June 11, 2022, 3:55 a.m. OK Java 11 TESTS 30 888 61644800
160158413 goel_mehul C June 11, 2022, 3:54 a.m. OK Java 11 TESTS 30 888 61644800
160148810 therrr C June 10, 2022, 10:03 p.m. OK Java 11 TESTS 30 935 71884800
160137355 tusharpruth C June 10, 2022, 6:59 p.m. OK Java 11 TESTS 30 951 68198400
160153029 gurkaran_s C June 11, 2022, 1:21 a.m. OK Java 11 TESTS 30 951 243200000
160153018 Sikander_2000 C June 11, 2022, 1:21 a.m. OK Java 11 TESTS 30 951 243200000
160128111 MunirKP C June 10, 2022, 6:11 p.m. OK Java 11 TESTS 30 998 65228800
160157350 RetARDed1111 C June 11, 2022, 3:29 a.m. OK Java 8 TESTS 30 233 12697600
160137131 RetARDed1111 C June 10, 2022, 6:59 p.m. OK Java 8 TESTS 30 249 5324800
160138757 WalrusRamen21 C June 10, 2022, 7:07 p.m. OK Java 8 TESTS 30 623 54784000
160137058 HideBeyondYou C June 10, 2022, 6:58 p.m. OK Java 8 TESTS 30 685 47513600
160126584 CrinklyGolem C June 10, 2022, 6:06 p.m. OK Java 8 TESTS 30 810 56832000
160126189 fyseus C June 10, 2022, 6:05 p.m. OK Java 8 TESTS 30 842 57753600
160140962 dheerajchhatanidc C June 10, 2022, 7:28 p.m. OK Java 8 TESTS 30 904 97382400
160135711 bardmanpig C June 10, 2022, 6:34 p.m. OK Java 8 TESTS 30 1076 85401600
160145774 ayafayed C June 10, 2022, 8:42 p.m. OK Java 8 TESTS 30 1076 107929600
160159508 z_zhaojun C June 11, 2022, 4:17 a.m. OK Java 8 TESTS 30 1107 160768000
160164649 BruteForcee C June 11, 2022, 5:41 a.m. OK Kotlin 1.4 TESTS 30 1170 169164800
160133785 ryanberg C June 10, 2022, 6:29 p.m. OK Kotlin 1.5 TESTS 30 966 78643200
160149492 SlavaG C June 10, 2022, 10:29 p.m. OK Kotlin 1.6 TESTS 30 1247 70553600
160149433 SlavaG C June 10, 2022, 10:27 p.m. OK Kotlin 1.6 TESTS 30 1372 70758400
160138857 Bossusuprem C June 10, 2022, 7:08 p.m. OK MS C++ 2017 TESTS 30 577 12390400
160141518 Viktor36 C June 10, 2022, 7:34 p.m. OK MS C++ 2017 TESTS 30 623 20889600
160153141 _Rimjhim_36 C June 11, 2022, 1:25 a.m. OK MS C++ 2017 TESTS 30 670 22835200
160150452 fatant C June 10, 2022, 11:11 p.m. OK MS C++ 2017 TESTS 30 686 21708800
160153255 fatant C June 11, 2022, 1:30 a.m. OK MS C++ 2017 TESTS 30 780 35123200
160147698 voicon C June 10, 2022, 9:31 p.m. OK PyPy 3 TESTS 30 889 39936000
160143808 KeiTsukishima C June 10, 2022, 8:06 p.m. OK PyPy 3 TESTS 30 920 63897600
160128900 Bryce3D C June 10, 2022, 6:14 p.m. OK PyPy 3 TESTS 30 1310 69120000
160157517 YMSeah C June 11, 2022, 3:33 a.m. OK PyPy 3 TESTS 30 1403 92774400
160162980 ambs_ C June 11, 2022, 5:17 a.m. OK PyPy 3 TESTS 30 1466 85708800
160159557 ambs_ C June 11, 2022, 4:18 a.m. OK PyPy 3 TESTS 30 1481 85708800
160159450 ambs_ C June 11, 2022, 4:17 a.m. OK PyPy 3 TESTS 30 1575 85708800
160129922 arpan.parikh C June 10, 2022, 6:17 p.m. OK PyPy 3 TESTS 30 1996 108236800
160143768 Beacon C June 10, 2022, 8:05 p.m. OK PyPy 3 TESTS 30 2651 34816000
160144329 theRealChainman C June 10, 2022, 8:15 p.m. OK PyPy 3-64 TESTS 30 623 56934400
160138446 aman_m42 C June 10, 2022, 7:05 p.m. OK PyPy 3-64 TESTS 30 779 95027200
160126800 alex391a C June 10, 2022, 6:07 p.m. OK PyPy 3-64 TESTS 30 982 61849600
160161443 Code_Breaker101 C June 11, 2022, 4:53 a.m. OK PyPy 3-64 TESTS 30 982 62771200
160137827 SophieHatter C June 10, 2022, 7:01 p.m. OK PyPy 3-64 TESTS 30 1465 203980800
160132210 golo C June 10, 2022, 6:25 p.m. OK PyPy 3-64 TESTS 30 1669 162406400
160149157 farrellbyu C June 10, 2022, 10:15 p.m. OK PyPy 3-64 TESTS 30 2199 210636800
160154044 dougn711 C June 11, 2022, 1:59 a.m. OK PyPy 3-64 TESTS 30 2355 87449600
160143832 Ayushman_123 C June 10, 2022, 8:06 p.m. OK PyPy 3-64 TESTS 30 2947 112742400
160138867 alonforces C June 10, 2022, 7:08 p.m. OK Python 3 TESTS 30 1871 261120000
160137143 sushmanth.dampur8780 C June 10, 2022, 6:59 p.m. OK Python 3 TESTS 30 2105 198144000
160150679 sjNxksbzj C June 10, 2022, 11:22 p.m. OK Python 3 TESTS 30 2152 235008000
160160161 Ayushman_123 C June 11, 2022, 4:30 a.m. OK Python 3 TESTS 30 2168 209612800
160159948 Ayushman_123 C June 11, 2022, 4:26 a.m. OK Python 3 TESTS 30 2277 210227200
160155258 shiviDON C June 11, 2022, 2:36 a.m. OK Python 3 TESTS 30 2293 258969600

remove filters

Back to search problems