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 |
---|---|---|---|---|---|---|
1926 | Codeforces Round 928 (Div. 4) | FINISHED | False | 8100 | 23469899 | Feb. 19, 2024, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3643 ) | G | Vlad and Trouble at MIT | PROGRAMMING | dfs and similar dp flows graphs greedy implementation trees |
B"Vladislav has a son who really wanted to go to MIT. The college dormitory at MIT (Moldova Institute of Technology) can be represented as a tree with n vertices, each vertex being a room with exactly one student. A tree is a connected undirected graph with n vertices and n-1 edges. Tonight, there are three types of students: Initially, all the edges are thin walls which allow music to pass through, so when a partying student puts music on, it will be heard in every room. However, we can place some thick walls on any edges -- thick walls don't allow music to pass through them. The university wants to install some thick walls so that every partying student can play music, and no sleepy student can hear it. Because the university lost a lot of money in a naming rights lawsuit, they ask you to find the minimum number of thick walls they will need to use. 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 an integer n ( 2 <= q n <= q 10^5 ) -- the number of vertices in the tree. The second line of each test case contains n-1 integers a_2, ... , a_n ( 1 <= q a_i < i ) -- it means there is an edge between i and a_i in the tree. The third line of each test case contains a string s of length n consisting of characters texttt{P} , texttt{S} , and texttt{C} , denoting that student i is of type s_i . The sum of n over all test cases does not exceed 10^5 . For each test case, output a single integer -- the minimum number of thick walls needed. In the first case, we can install one thick wall between rooms 1 and 2 , as shown below. We cannot install 0 walls, since then the music from room 3 will reach room 2 where a student wants to sleep, so the answer is 1 . There are other valid solutions. "... |
126132 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
247424770 | mr.tj.mr | G | Feb. 20, 2024, 4:46 a.m. | OK | GNU C++17 | TESTS | 18 | 46 | 1331200 | ||
247396505 | prakhar7472pk | G | Feb. 19, 2024, 8:46 p.m. | OK | GNU C++17 | TESTS | 18 | 46 | 3993600 | ||
247375752 | GADIRI | G | Feb. 19, 2024, 5:39 p.m. | OK | GNU C++17 | TESTS | 18 | 46 | 5632000 | ||
247369465 | _Fer3on_ | G | Feb. 19, 2024, 5:05 p.m. | OK | GNU C++17 | TESTS | 18 | 46 | 5939200 | ||
247403487 | ArfatulAsif | G | Feb. 19, 2024, 10:37 p.m. | OK | GNU C++17 | TESTS | 18 | 46 | 6246400 | ||
247413424 | SaMuEl0516 | G | Feb. 20, 2024, 2:07 a.m. | OK | GNU C++17 | TESTS | 18 | 46 | 8294400 | ||
247421982 | D1stance | G | Feb. 20, 2024, 4:06 a.m. | OK | GNU C++17 | TESTS | 18 | 46 | 9420800 | ||
247408407 | tumharabaap642 | G | Feb. 20, 2024, 12:34 a.m. | OK | GNU C++17 | TESTS | 18 | 46 | 9523200 | ||
247394695 | kingsneverdie1411 | G | Feb. 19, 2024, 8:25 p.m. | OK | GNU C++17 | TESTS | 18 | 46 | 9523200 | ||
247377946 | TANMAY_1408 | G | Feb. 19, 2024, 5:54 p.m. | OK | GNU C++17 | TESTS | 18 | 46 | 9523200 | ||
247418713 | Yaoyuan | G | Feb. 20, 2024, 3:23 a.m. | OK | GNU C++17 (64) | TESTS | 18 | 31 | 13926400 | ||
247414591 | scutsky | G | Feb. 20, 2024, 2:26 a.m. | OK | GNU C++17 (64) | TESTS | 18 | 31 | 14643200 | ||
247368312 | wuzihan | G | Feb. 19, 2024, 5 p.m. | OK | GNU C++17 (64) | TESTS | 18 | 31 | 18534400 | ||
247384215 | biank | G | Feb. 19, 2024, 6:42 p.m. | OK | GNU C++17 (64) | TESTS | 18 | 46 | 13824000 | ||
247417871 | enslaved | G | Feb. 20, 2024, 3:13 a.m. | OK | GNU C++17 (64) | TESTS | 18 | 46 | 14540800 | ||
247371161 | lnu_xunxxxx | G | Feb. 19, 2024, 5:13 p.m. | OK | GNU C++17 (64) | TESTS | 18 | 46 | 14643200 | ||
247426404 | ABASD | G | Feb. 20, 2024, 5:06 a.m. | OK | GNU C++17 (64) | TESTS | 18 | 46 | 14950400 | ||
247370993 | hhhyh_1 | G | Feb. 19, 2024, 5:12 p.m. | OK | GNU C++17 (64) | TESTS | 18 | 46 | 15462400 | ||
247415350 | jdurie | G | Feb. 20, 2024, 2:38 a.m. | OK | GNU C++17 (64) | TESTS | 18 | 46 | 15564800 | ||
247416099 | CoolKuangLoveLT | G | Feb. 20, 2024, 2:49 a.m. | OK | GNU C++17 (64) | TESTS | 18 | 46 | 16179200 | ||
247422171 | yukiKang | G | Feb. 20, 2024, 4:08 a.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 8396800 | ||
247405089 | _no__way | G | Feb. 19, 2024, 11:15 p.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 9932800 | ||
247387790 | MemoryEfficientCode | G | Feb. 19, 2024, 7:14 p.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 9932800 | ||
247426313 | embetapbay | G | Feb. 20, 2024, 5:05 a.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 14745600 | ||
247425064 | 17107201 | G | Feb. 20, 2024, 4:50 a.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 14745600 | ||
247412042 | Omar_Farhan | G | Feb. 20, 2024, 1:44 a.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 15974400 | ||
247423161 | xylu | G | Feb. 20, 2024, 4:23 a.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 18739200 | ||
247398405 | Shadyii | G | Feb. 19, 2024, 9:10 p.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 18739200 | ||
247397956 | ibrahimhanifceker | G | Feb. 19, 2024, 9:04 p.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 18739200 | ||
247372919 | CtrlAltDefeat22 | G | Feb. 19, 2024, 5:22 p.m. | OK | GNU C++20 (64) | TESTS | 18 | 31 | 19558400 | ||
247416524 | sugar2023 | G | Feb. 20, 2024, 2:55 a.m. | OK | Go | TESTS | 18 | 93 | 44236800 | ||
247374185 | north_069 | G | Feb. 19, 2024, 5:29 p.m. | OK | Go | TESTS | 18 | 109 | 45977600 | ||
247417788 | dzhi | G | Feb. 20, 2024, 3:12 a.m. | OK | Java 21 | TESTS | 18 | 358 | 12697600 | ||
247394774 | faresbadr316 | G | Feb. 19, 2024, 8:26 p.m. | OK | Java 21 | TESTS | 18 | 358 | 30208000 | ||
247370364 | _mza | G | Feb. 19, 2024, 5:09 p.m. | OK | Java 21 | TESTS | 18 | 358 | 34508800 | ||
247369912 | ich_bin_mza | G | Feb. 19, 2024, 5:07 p.m. | OK | Java 21 | TESTS | 18 | 358 | 34508800 | ||
247389172 | santanu021 | G | Feb. 19, 2024, 7:28 p.m. | OK | Java 21 | TESTS | 18 | 405 | 53350400 | ||
247417245 | HWJHWJ | G | Feb. 20, 2024, 3:05 a.m. | OK | Java 21 | TESTS | 18 | 420 | 37478400 | ||
247414458 | Zhanzhe_Lee | G | Feb. 20, 2024, 2:24 a.m. | OK | Java 21 | TESTS | 18 | 499 | 32665600 | ||
247400811 | Rishi_Kumar_Singh | G | Feb. 19, 2024, 9:44 p.m. | OK | Java 21 | TESTS | 18 | 577 | 26931200 | ||
247394810 | Yousef_Badr | G | Feb. 19, 2024, 8:26 p.m. | OK | Java 8 | TESTS | 18 | 187 | 23347200 | ||
247422438 | PROELECTRO444 | G | Feb. 20, 2024, 4:12 a.m. | OK | OCaml | TESTS | 18 | 78 | 10240000 | ||
247424531 | luoingly | G | Feb. 20, 2024, 4:43 a.m. | OK | PHP | TESTS | 18 | 139 | 128204800 | ||
247394543 | gardengnome | G | Feb. 19, 2024, 8:23 p.m. | OK | PyPy 3-64 | TESTS | 18 | 109 | 16281600 | ||
247426852 | wyjsdpku | G | Feb. 20, 2024, 5:11 a.m. | OK | PyPy 3-64 | TESTS | 18 | 124 | 19046400 | ||
247374405 | AyuAnchor | G | Feb. 19, 2024, 5:31 p.m. | OK | PyPy 3-64 | TESTS | 18 | 155 | 18636800 | ||
247414443 | find | G | Feb. 20, 2024, 2:24 a.m. | OK | PyPy 3-64 | TESTS | 18 | 155 | 24473600 | ||
247410747 | Little_Sheep_Yawn | G | Feb. 20, 2024, 1:21 a.m. | OK | PyPy 3-64 | TESTS | 18 | 170 | 20275200 | ||
247388962 | lionel.m | G | Feb. 19, 2024, 7:26 p.m. | OK | PyPy 3-64 | TESTS | 18 | 171 | 13414400 | ||
247373967 | AyuAnchor | G | Feb. 19, 2024, 5:28 p.m. | OK | PyPy 3-64 | TESTS | 18 | 171 | 20480000 | ||
247372278 | gdstw | G | Feb. 19, 2024, 5:19 p.m. | OK | PyPy 3-64 | TESTS | 18 | 202 | 14438400 | ||
247373066 | AyuAnchor | G | Feb. 19, 2024, 5:23 p.m. | OK | PyPy 3-64 | TESTS | 18 | 218 | 21708800 | ||
247372615 | nits-starters | G | Feb. 19, 2024, 5:20 p.m. | OK | PyPy 3-64 | TESTS | 18 | 218 | 21708800 | ||
247376436 | OLOGY | G | Feb. 19, 2024, 5:43 p.m. | OK | Python 2 | TESTS | 18 | 202 | 6348800 | ||
247393029 | OLOGY | G | Feb. 19, 2024, 8:07 p.m. | OK | Python 2 | TESTS | 18 | 218 | 6348800 | ||
247413008 | OLOGY | G | Feb. 20, 2024, 2:01 a.m. | OK | Python 2 | TESTS | 18 | 295 | 11673600 | ||
247375665 | OLOGY | G | Feb. 19, 2024, 5:38 p.m. | OK | Python 2 | TESTS | 18 | 327 | 6348800 | ||
247413571 | OLOGY | G | Feb. 20, 2024, 2:10 a.m. | OK | Python 2 | TESTS | 18 | 327 | 12595200 | ||
247370567 | Ali_P | G | Feb. 19, 2024, 5:10 p.m. | OK | Python 3 | TESTS | 18 | 140 | 14028800 | ||
247386637 | snamy520 | G | Feb. 19, 2024, 7:03 p.m. | OK | Rust 2021 | TESTS | 18 | 31 | 25907200 | ||
247378214 | KasodaniKyouko | G | Feb. 19, 2024, 5:55 p.m. | OK | Rust 2021 | TESTS | 18 | 46 | 18944000 | ||
247381082 | robostac | G | Feb. 19, 2024, 6:16 p.m. | OK | Rust 2021 | TESTS | 18 | 46 | 26214400 |
Back to search problems