Codeforces Round 699 (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
1481 Codeforces Round 699 (Div. 2) FINISHED False 7200 124644263 Feb. 5, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 542 ) F AB Tree PROGRAMMING dp greedy trees

B"Kilani and Abd are neighbors for 3000 years, but then the day came and Kilani decided to move to another house. As a farewell gift, Kilani is going to challenge Abd with a problem written by their other neighbor with the same name Abd. The problem is: You are given a connected tree rooted at node 1 . You should assign a character a or b to every node in the tree so that the total number of a's is equal to x and the total number of b's is equal to n - x . Let's define a string for each node v of the tree as follows: You should assign every node a character in a way that minimizes the number of distinct strings among the strings of all nodes. The first line contains two integers n and x ( 1 <= q n <= q 10^5 ; 0 <= q x <= q n ) -- the number of vertices in the tree the number of a's. The second line contains n - 1 integers p_2, p_3, ... , p_{n} ( 1 <= q p_i <= q n ; p_i neq i ), where p_i is the parent of node i . It is guaranteed that the input describes a connected tree. In the first line, print the minimum possible total number of distinct strings. In the second line, print n characters, where all characters are either a or b and the i -th character is the character assigned to the i -th node. Make sure that the total number of a's is equal to x and the total number of b's is equal to n - x . If there is more than one answer you can print any of them. The tree from the sample is shown below: The tree after assigning characters to every node (according to the output) is the following: Strings for all nodes are the following: The set of unique strings is { text{a}, text{aa}, text{aab}, text{aabb} } , so the number of distinct strings is 4 . "...

Tutorials

Codeforces Round #699 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
106625404 rainboy F Feb. 5, 2021, 8:16 p.m. OK GNU C11 TESTS 84 140 6656000
106639491 wsyhb F Feb. 6, 2021, 3:57 a.m. OK GNU C++11 TESTS 84 78 8499200
106640138 Komeiji_Green F Feb. 6, 2021, 4:10 a.m. OK GNU C++11 TESTS 84 155 220979200
106618016 georgerapeanu F Feb. 5, 2021, 6:23 p.m. OK GNU C++11 TESTS 84 217 210329600
106645440 Grice F Feb. 6, 2021, 5:45 a.m. OK GNU C++11 TESTS 84 217 262451200
106604290 2005lz F Feb. 5, 2021, 4:28 p.m. OK GNU C++11 TESTS 84 249 12595200
106632220 tuagoale F Feb. 6, 2021, 12:14 a.m. OK GNU C++11 TESTS 84 608 19763200
106635606 q-w-q-w-q F Feb. 6, 2021, 2:17 a.m. OK GNU C++11 TESTS 84 1326 5836800
106634511 ButterCake F Feb. 6, 2021, 1:41 a.m. OK GNU C++11 TESTS 84 1528 72908800
106634565 ButterCake F Feb. 6, 2021, 1:43 a.m. OK GNU C++11 TESTS 84 1684 72908800
106634635 ButterCake F Feb. 6, 2021, 1:46 a.m. OK GNU C++11 TESTS 84 1700 72908800
106630709 SuperJ6 F Feb. 5, 2021, 11:11 p.m. OK GNU C++14 TESTS 84 78 12902400
106630822 SuperJ6 F Feb. 5, 2021, 11:16 p.m. OK GNU C++14 TESTS 84 93 12902400
106611573 qwang1231 F Feb. 5, 2021, 5:24 p.m. OK GNU C++14 TESTS 84 93 62156800
106642156 marcOS F Feb. 6, 2021, 4:53 a.m. OK GNU C++14 TESTS 84 139 115916800
106612763 iaNTU F Feb. 5, 2021, 5:32 p.m. OK GNU C++17 TESTS 84 77 10956800
106640650 anodiebird F Feb. 6, 2021, 4:22 a.m. OK GNU C++17 TESTS 84 108 71987200
106636375 The_Human F Feb. 6, 2021, 2:40 a.m. OK GNU C++17 TESTS 84 124 12902400
106636857 mafailure F Feb. 6, 2021, 2:54 a.m. OK GNU C++17 TESTS 84 155 144998400
106630022 jeroenodb F Feb. 5, 2021, 10:42 p.m. OK GNU C++17 TESTS 84 171 8908800
106640201 kmjp F Feb. 6, 2021, 4:12 a.m. OK GNU C++17 TESTS 84 1044 11161600
106626903 realcomplex F Feb. 5, 2021, 8:54 p.m. OK GNU C++17 TESTS 84 1154 193945600
106644657 generic_placeholder_name F Feb. 6, 2021, 5:34 a.m. OK GNU C++17 (64) TESTS 84 46 13209600
106642556 generic_placeholder_name F Feb. 6, 2021, 5:02 a.m. OK GNU C++17 (64) TESTS 84 61 13619200
106619988 generic_placeholder_name F Feb. 5, 2021, 6:49 p.m. OK GNU C++17 (64) TESTS 84 62 13619200
106634141 Froggygua F Feb. 6, 2021, 1:28 a.m. OK GNU C++17 (64) TESTS 84 77 33484800
106634187 froggyzhang F Feb. 6, 2021, 1:29 a.m. OK GNU C++17 (64) TESTS 84 77 33484800
106617392 deepspacewaifu F Feb. 5, 2021, 6:16 p.m. OK GNU C++17 (64) TESTS 84 93 23347200
106624600 fivefourthreeone F Feb. 5, 2021, 7:59 p.m. OK GNU C++17 (64) TESTS 84 93 23347200
106643090 DreamingLeaf F Feb. 6, 2021, 5:11 a.m. OK GNU C++17 (64) TESTS 84 109 22732800
106636854 haruki_K F Feb. 6, 2021, 2:54 a.m. OK GNU C++17 (64) TESTS 84 140 120627200
106604584 Heltion F Feb. 5, 2021, 4:29 p.m. OK GNU C++17 (64) TESTS 84 280 221593600
106632379 clyring F Feb. 6, 2021, 12:20 a.m. OK Haskell TESTS 84 124 18022400
106632238 clyring F Feb. 6, 2021, 12:15 a.m. OK Haskell TESTS 84 436 19046400
106619730 Tlatoani F Feb. 5, 2021, 6:45 p.m. OK Kotlin TESTS 84 1294 256307200
106624436 awoo F Feb. 5, 2021, 7:56 p.m. OK PyPy 2 TESTS 84 1466 51097600

remove filters

Back to search problems