Codeforces Round 572 (Div. 1)

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
1188 Codeforces Round 572 (Div. 1) FINISHED False 7200 175100087 July 5, 2019, 3:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1252 ) A2 Add on a Tree: Revolution PROGRAMMING constructive algorithms dfs and similar implementation trees 2500

B'Note that this is the second problem of the two similar problems. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems. You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any 2 distinct leaves u , v and any integer number x and add x to values written on all edges on the simple path between u and v . Note that in previous subtask x was allowed to be any real, here it has to be integer. For example, on the picture below you can see the result of applying two operations to the graph: adding 2 on the path from 7 to 6 , and then adding -1 on the path from 4 to 5 . You are given some configuration of nonnegative integer pairwise different even numbers, written on the edges. For a given configuration determine if it is possible to achieve it with these operations, and, if it is possible, output the sequence of operations that leads to the given configuration. Constraints on the operations are listed in the output format section. Leave is a node of a tree of degree 1 . Simple path is a path that doesn 't contain any node twice. The first line contains a single integer n ( 2 <= n <= 1000 ) -- the number of nodes in a tree. Each of the next n-1 lines contains three integers u , v , val ( 1 <= u, v <= n , u neq v , 0 <= val <= 10 ,000 ), meaning that there is an edge between nodes u and v with val written on it. It is guaranteed that these edges form a tree. It is guaranteed that all val numbers are pairwise different and even. If there aren 't any sequences of operations which lead to the given configuration, output "NO". If it exists, output "YES" in the first line. In the second line output m -- number of operations you are going to apply ( 0 <= m <= 10^5 )'...

Tutorials

Editorial of Codeforces Round #572

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
67032615 rainboy A2 Dec. 16, 2019, 4:20 p.m. OK GNU C11 TESTS 28 31 102400 2500
56879834 FlappyFish A2 July 12, 2019, 9:54 a.m. OK GNU C++11 TESTS 28 30 102400 2500
60949028 geniucos A2 Sept. 20, 2019, 8:28 p.m. OK GNU C++11 TESTS 28 30 102400 2500
56630597 Richard_love_OI A2 July 6, 2019, 4:05 p.m. OK GNU C++11 TESTS 28 30 204800 2500
57203602 2829908231 A2 July 17, 2019, 2:36 p.m. OK GNU C++11 TESTS 28 30 204800 2500
56882125 hiwatermellon A2 July 12, 2019, 10:56 a.m. OK GNU C++11 TESTS 28 30 307200 2500
59641483 cjxj233 A2 Aug. 29, 2019, 2:03 a.m. OK GNU C++11 TESTS 28 30 24473600 2500
61259012 foreverlasting A2 Sept. 25, 2019, 11:05 a.m. OK GNU C++11 TESTS 28 31 102400 2500
58687983 hz2016 A2 Aug. 13, 2019, 1:24 a.m. OK GNU C++11 TESTS 28 31 102400 2500
57865195 lopare A2 July 27, 2019, 8:30 p.m. OK GNU C++11 TESTS 28 31 102400 2500
66155876 sniffleheim A2 Dec. 1, 2019, 10:25 p.m. OK GNU C++11 TESTS 28 31 102400 2500
56582675 PumpkinYing A2 July 5, 2019, 4:18 p.m. OK GNU C++14 TESTS 28 15 307200 2500
56867213 tick A2 July 12, 2019, 3:59 a.m. OK GNU C++14 TESTS 28 15 307200 2500
56587448 I_love_chickpea A2 July 5, 2019, 4:45 p.m. OK GNU C++14 TESTS 28 15 409600 2500
57747005 79brue A2 July 25, 2019, 1:24 p.m. OK GNU C++14 TESTS 28 15 4300800 2500
57558854 KevinWan A2 July 22, 2019, 10:02 p.m. OK GNU C++14 TESTS 28 15 4403200 2500
61103837 1706915033 A2 Sept. 23, 2019, 8:12 a.m. OK GNU C++14 TESTS 28 30 204800 2500
59930142 Scut82 A2 Sept. 3, 2019, 6:43 a.m. OK GNU C++14 TESTS 28 30 204800 2500
56810927 LittleFall A2 July 10, 2019, 4:04 p.m. OK GNU C++14 TESTS 28 30 204800 2500
62548815 mayaohua2003 A2 Oct. 14, 2019, 7:40 a.m. OK GNU C++14 TESTS 28 30 204800 2500
58631959 emma A2 Aug. 11, 2019, 8:26 p.m. OK GNU C++14 TESTS 28 30 307200 2500
56626401 CMXRYNP A2 July 6, 2019, 2:08 p.m. OK GNU C++17 TESTS 28 15 204800 2500
56644922 Trote_w A2 July 7, 2019, 5:46 a.m. OK GNU C++17 TESTS 28 15 307200 2500
56575705 cerberus97 A2 July 5, 2019, 3:47 p.m. OK GNU C++17 TESTS 28 15 307200 2500
61271458 hjk1030 A2 Sept. 25, 2019, 2:11 p.m. OK GNU C++17 TESTS 28 15 307200 2500
56643315 pkgunboat A2 July 7, 2019, 4:10 a.m. OK GNU C++17 TESTS 28 15 409600 2500
56636477 Vax A2 July 6, 2019, 7:56 p.m. OK GNU C++17 TESTS 28 15 409600 2500
56591489 shubham__36 A2 July 5, 2019, 5:41 p.m. OK GNU C++17 TESTS 28 15 409600 2500
59705857 Juve45 A2 Aug. 30, 2019, 12:37 p.m. OK GNU C++17 TESTS 28 15 2355200 2500
56597923 Holidin A2 July 5, 2019, 8:43 p.m. OK GNU C++17 TESTS 28 15 5939200 2500
63059526 9baka_Cirno A2 Oct. 21, 2019, 8:03 a.m. OK GNU C++17 TESTS 28 15 16896000 2500
67032614 Dukkha A2 Dec. 16, 2019, 4:20 p.m. OK Java 11 TESTS 28 280 307200 2500
59634858 qwerty787788 A2 Aug. 28, 2019, 8:05 p.m. OK Java 8 TESTS 28 109 0 2500
56599607 fetetriste A2 July 5, 2019, 10:13 p.m. OK Java 8 TESTS 28 124 0 2500
61861811 beginner1010 A2 Oct. 4, 2019, 3:32 p.m. OK Java 8 TESTS 28 124 0 2500
56603389 dalt A2 July 6, 2019, 2:38 a.m. OK Java 8 TESTS 28 124 0 2500
56594896 tanzaku A2 July 5, 2019, 6:53 p.m. OK Java 8 TESTS 28 139 0 2500
56593643 dusty.and.rusty A2 July 5, 2019, 6:21 p.m. OK Java 8 TESTS 28 186 0 2500
56612084 dusty.and.rusty A2 July 6, 2019, 7:49 a.m. OK Java 8 TESTS 28 187 0 2500
56593076 dusty.and.rusty A2 July 5, 2019, 6:09 p.m. OK Java 8 TESTS 28 202 0 2500
56582383 knightL A2 July 5, 2019, 4:17 p.m. OK Kotlin TESTS 28 187 1843200 2500
56573795 darnley A2 July 5, 2019, 3:41 p.m. OK Kotlin TESTS 28 202 204800 2500
56640420 darnley A2 July 7, 2019, 1 a.m. OK Kotlin TESTS 28 202 1228800 2500
56640280 darnley A2 July 7, 2019, 12:48 a.m. OK Kotlin TESTS 28 202 1331200 2500
56640238 darnley A2 July 7, 2019, 12:44 a.m. OK Kotlin TESTS 28 202 1331200 2500
56639756 darnley A2 July 6, 2019, 11:54 p.m. OK Kotlin TESTS 28 218 204800 2500
56746577 eki A2 July 9, 2019, 10 a.m. OK Mono C# TESTS 28 77 4915200 2500
57550349 vjudge5 A2 July 22, 2019, 5:14 p.m. OK MS C++ TESTS 28 31 8806400 2500
57571529 hld67890 A2 July 23, 2019, 5:27 a.m. OK MS C++ 2017 TESTS 28 31 512000 2500
56587500 Milanin A2 July 5, 2019, 4:46 p.m. OK MS C++ 2017 TESTS 28 31 4198400 2500
56728089 mandinga A2 July 8, 2019, 9:31 p.m. OK MS C++ 2017 TESTS 28 46 204800 2500
57532860 Helli.code A2 July 22, 2019, 3:28 p.m. OK Python 2 TESTS 28 186 512000 2500
56607384 Indecchi A2 July 6, 2019, 5:34 a.m. OK Python 2 TESTS 28 187 512000 2500
56592043 EbTech A2 July 5, 2019, 5:49 p.m. OK Rust TESTS 28 31 204800 2500
69853321 gearjack A2 Jan. 30, 2020, 4:16 p.m. OK Rust TESTS 28 77 512000 2500

remove filters

Back to search problems