Codeforces Round 756 (Div. 3)

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
1611 Codeforces Round 756 (Div. 3) FINISHED False 8100 99329063 Nov. 25, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10050 ) D Weights Assignment For Tree Edges PROGRAMMING constructive algorithms trees 1500

B'You are given a rooted tree consisting of n vertices. Vertices are numbered from 1 to n . Any vertex can be the root of a tree. A tree is a connected undirected graph without cycles. A rooted tree is a tree with a selected vertex, which is called the root. The tree is specified by an array of ancestors b containing n numbers: b_i is an ancestor of the vertex with the number i . The ancestor of a vertex u is a vertex that is the next vertex on a simple path from u to the root. For example, on the simple path from 5 to 3 (the root), the next vertex would be 1 , so the ancestor of 5 is 1 . The root has no ancestor, so for it, the value of b_i is i (the root is the only vertex for which b_i=i ). For example, if n=5 and b=[3, 1, 3, 3, 1] , then the tree looks like this. You are given an array p -- a permutation of the vertices of the tree. If it is possible, assign any positive integer weights on the edges, so that the vertices sorted by distance from the root would form the given permutation p . In other words, for a given permutation of vertices p , it is necessary to choose such edge weights so that the condition dist[p_i]<dist[p_{i+1}] is true for each i from 1 to n-1 . dist[u] is a sum of the weights of the edges on the path from the root to u . In particular, dist[u]=0 if the vertex u is the root of the tree. For example, assume that p=[3, 1, 2, 5, 4] . In this case, the following edge weights satisfy this permutation: The array of distances from the root looks like: dist=[1,11,0,102,101] . The vertices sorted by increasing the distance from the root form the given permutation p . Print the required edge weights or determine that there is no suitable way to assign weights. If there are several solutions, then print any of them. The first line of input data contains an int'...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
136951928 ssvb D Nov. 26, 2021, 12:57 a.m. OK D TESTS 7 327 75776000 1500
136939003 Mrgglock D Nov. 25, 2021, 6:42 p.m. OK GNU C11 TESTS 7 187 14028800 1500
137001227 parthu D Nov. 26, 2021, 11:32 a.m. OK GNU C11 TESTS 7 842 3174400 1500
136969079 runk20 D Nov. 26, 2021, 6:45 a.m. OK GNU C11 TESTS 7 858 4812800 1500
136982847 wangyian2022 D Nov. 26, 2021, 9:39 a.m. OK GNU C++14 TESTS 7 78 7782400 1500
136976168 Rhyems D Nov. 26, 2021, 8:17 a.m. OK GNU C++14 TESTS 7 108 3174400 1500
136958591 tzh2001 D Nov. 26, 2021, 3:49 a.m. OK GNU C++14 TESTS 7 108 7987200 1500
136955704 m1979823301m D Nov. 26, 2021, 2:46 a.m. OK GNU C++14 TESTS 7 109 2457600 1500
136984319 Invisible_Shadow D Nov. 26, 2021, 10 a.m. OK GNU C++14 TESTS 7 109 2457600 1500
137038754 fj777 D Nov. 26, 2021, 1:16 p.m. OK GNU C++14 TESTS 7 109 2457600 1500
136958175 Code_bug2021 D Nov. 26, 2021, 3:40 a.m. OK GNU C++14 TESTS 7 109 2560000 1500
136956035 AIM-9X D Nov. 26, 2021, 2:53 a.m. OK GNU C++14 TESTS 7 109 3174400 1500
136963521 ketoin D Nov. 26, 2021, 5:29 a.m. OK GNU C++14 TESTS 7 109 3174400 1500
136972359 Hieupc D Nov. 26, 2021, 7:26 a.m. OK GNU C++14 TESTS 7 109 3174400 1500
136957651 Bakti-Tuymehan-abai-2025 D Nov. 26, 2021, 3:29 a.m. OK GNU C++17 TESTS 7 31 5324800 1500
136950512 sudhanshumishra221220 D Nov. 25, 2021, 11:54 p.m. OK GNU C++17 TESTS 7 108 2457600 1500
136955296 s39202972 D Nov. 26, 2021, 2:36 a.m. OK GNU C++17 TESTS 7 108 3174400 1500
136938888 KhaledFarhat D Nov. 25, 2021, 6:40 p.m. OK GNU C++17 TESTS 7 108 3174400 1500
136978011 lcyyy D Nov. 26, 2021, 8:38 a.m. OK GNU C++17 TESTS 7 108 3174400 1500
136973852 _Doruletz_ D Nov. 26, 2021, 7:46 a.m. OK GNU C++17 TESTS 7 108 3174400 1500
136984620 Kellin D Nov. 26, 2021, 10:04 a.m. OK GNU C++17 TESTS 7 108 3584000 1500
136954290 danz100 D Nov. 26, 2021, 2:12 a.m. OK GNU C++17 TESTS 7 108 8192000 1500
137053310 Kirill_Maglysh D Nov. 26, 2021, 3:52 p.m. OK GNU C++17 TESTS 7 109 1638400 1500
136945180 arul.ashri D Nov. 25, 2021, 8:34 p.m. OK GNU C++17 TESTS 7 109 1638400 1500
136977334 vishalagrawal D Nov. 26, 2021, 8:31 a.m. OK GNU C++17 (64) TESTS 7 62 6451200 1500
137057232 cloudcloud D Nov. 26, 2021, 4:45 p.m. OK GNU C++17 (64) TESTS 7 77 1638400 1500
136967536 shubhamgrg1000 D Nov. 26, 2021, 6:25 a.m. OK GNU C++17 (64) TESTS 7 77 2355200 1500
136974786 thonns178 D Nov. 26, 2021, 7:59 a.m. OK GNU C++17 (64) TESTS 7 77 2457600 1500
136984821 guo3125976202 D Nov. 26, 2021, 10:07 a.m. OK GNU C++17 (64) TESTS 7 77 3174400 1500
136946124 kojak_ D Nov. 25, 2021, 8:58 p.m. OK GNU C++17 (64) TESTS 7 77 3276800 1500
136985789 ha15 D Nov. 26, 2021, 10:21 a.m. OK GNU C++17 (64) TESTS 7 77 3276800 1500
137053106 doing_cloth D Nov. 26, 2021, 3:49 p.m. OK GNU C++17 (64) TESTS 7 77 3276800 1500
136973839 _fire_fly_ D Nov. 26, 2021, 7:45 a.m. OK GNU C++17 (64) TESTS 7 77 3276800 1500
136954040 froggyzhang D Nov. 26, 2021, 2:05 a.m. OK GNU C++17 (64) TESTS 7 77 3993600 1500
137076008 lmnopqrst D Nov. 27, 2021, 12:33 a.m. OK GNU C++20 (64) TESTS 7 46 2457600 1500
136954537 _elgir D Nov. 26, 2021, 2:18 a.m. OK GNU C++20 (64) TESTS 7 46 3174400 1500
136960046 imurfather D Nov. 26, 2021, 4:21 a.m. OK GNU C++20 (64) TESTS 7 46 3276800 1500
137071080 allFiredUp_ftw D Nov. 26, 2021, 8:54 p.m. OK GNU C++20 (64) TESTS 7 61 4812800 1500
137058937 GoracioNewport D Nov. 26, 2021, 5:09 p.m. OK GNU C++20 (64) TESTS 7 61 6451200 1500
136982024 VietKieuMyanmar D Nov. 26, 2021, 9:28 a.m. OK GNU C++20 (64) TESTS 7 62 1638400 1500
136950286 ivan100sic D Nov. 25, 2021, 11:43 p.m. OK GNU C++20 (64) TESTS 7 62 2457600 1500
136954567 _elgir D Nov. 26, 2021, 2:19 a.m. OK GNU C++20 (64) TESTS 7 62 3174400 1500
136955135 _elgir D Nov. 26, 2021, 2:32 a.m. OK GNU C++20 (64) TESTS 7 62 3174400 1500
136936882 Grapeee D Nov. 25, 2021, 6:12 p.m. OK GNU C++20 (64) TESTS 7 62 3174400 1500
137011617 solo07 D Nov. 26, 2021, 11:56 a.m. OK Java 11 TESTS 7 217 0 1500
136960456 harsh005 D Nov. 26, 2021, 4:30 a.m. OK Java 11 TESTS 7 217 0 1500
137087008 aashay_03 D Nov. 27, 2021, 5 a.m. OK Java 11 TESTS 7 234 0 1500
136973877 dheerajchhatanidc D Nov. 26, 2021, 7:46 a.m. OK Java 11 TESTS 7 234 0 1500
136948056 Toinfinity D Nov. 25, 2021, 10 p.m. OK Java 11 TESTS 7 280 0 1500
136973316 sumitchavan D Nov. 26, 2021, 7:38 a.m. OK Java 11 TESTS 7 296 1126400 1500
136950558 sarthakmanna D Nov. 25, 2021, 11:56 p.m. OK Java 11 TESTS 7 342 20992000 1500
136955876 ddwuya D Nov. 26, 2021, 2:50 a.m. OK Java 11 TESTS 7 374 30105600 1500
136973962 MrOtter D Nov. 26, 2021, 7:47 a.m. OK Java 11 TESTS 7 389 19148800 1500
136977752 Yash9890 D Nov. 26, 2021, 8:35 a.m. OK Java 11 TESTS 7 405 21811200 1500
137067937 pras7946 D Nov. 26, 2021, 7:39 p.m. OK Java 8 TESTS 7 171 7168000 1500
136986204 ljc1113 D Nov. 26, 2021, 10:27 a.m. OK Java 8 TESTS 7 186 8908800 1500
136981415 syedmizbah D Nov. 26, 2021, 9:20 a.m. OK Java 8 TESTS 7 187 7782400 1500
136940070 ruchir28 D Nov. 25, 2021, 6:58 p.m. OK Java 8 TESTS 7 187 11161600 1500
136987925 g906360 D Nov. 26, 2021, 10:50 a.m. OK Java 8 TESTS 7 218 6758400 1500
136947086 Akram-Adel D Nov. 25, 2021, 9:26 p.m. OK Java 8 TESTS 7 296 16998400 1500
136976804 alibaba D Nov. 26, 2021, 8:24 a.m. OK Java 8 TESTS 7 467 37171200 1500
136946441 omar_mohammed D Nov. 25, 2021, 9:07 p.m. OK Java 8 TESTS 7 514 57446400 1500
136961707 RonWonWon D Nov. 26, 2021, 4:53 a.m. OK Java 8 TESTS 7 561 77312000 1500
137049838 zimuqin D Nov. 26, 2021, 3:08 p.m. OK Java 8 TESTS 7 858 7372800 1500
136972105 huy.caohuyhuy123 D Nov. 26, 2021, 7:22 a.m. OK Kotlin 1.5 TESTS 7 638 29593600 1500
136949742 dlehgns011 D Nov. 25, 2021, 11:12 p.m. OK MS C++ 2017 TESTS 7 358 3174400 1500
136973885 thonns178 D Nov. 26, 2021, 7:46 a.m. OK MS C++ 2017 TESTS 7 374 2457600 1500
136973771 thonns178 D Nov. 26, 2021, 7:44 a.m. OK MS C++ 2017 TESTS 7 405 2457600 1500
136971867 no_ac_no_sleep D Nov. 26, 2021, 7:19 a.m. OK MS C++ 2017 TESTS 7 421 3174400 1500
136955225 fatant D Nov. 26, 2021, 2:35 a.m. OK MS C++ 2017 TESTS 7 436 6451200 1500
136965223 ANDREYkao__ D Nov. 26, 2021, 5:53 a.m. OK MS C++ 2017 TESTS 7 499 9625600 1500
136965059 ANDREYkao__ D Nov. 26, 2021, 5:50 a.m. OK MS C++ 2017 TESTS 7 514 9625600 1500
136940707 NorbertG D Nov. 25, 2021, 7:09 p.m. OK .NET Core C# TESTS 7 187 43417600 1500
136975335 saurabhbisht D Nov. 26, 2021, 8:06 a.m. OK PyPy 3 TESTS 7 217 27136000 1500
136943226 Believer_Ayush D Nov. 25, 2021, 7:54 p.m. OK PyPy 3 TESTS 7 249 32051200 1500
136986004 xyxoro D Nov. 26, 2021, 10:24 a.m. OK PyPy 3 TESTS 7 280 36352000 1500
136980192 ps_12 D Nov. 26, 2021, 9:04 a.m. OK PyPy 3 TESTS 7 358 31027200 1500
136950441 tesSer16 D Nov. 25, 2021, 11:52 p.m. OK PyPy 3 TESTS 7 483 22732800 1500
136982100 gennadylaptev D Nov. 26, 2021, 9:29 a.m. OK PyPy 3 TESTS 7 483 28057600 1500
136957772 vdh_123 D Nov. 26, 2021, 3:31 a.m. OK PyPy 3 TESTS 7 498 42803200 1500
137069348 wolfram_ D Nov. 26, 2021, 8:09 p.m. OK PyPy 3 TESTS 7 499 23142400 1500
136983964 Greyhound D Nov. 26, 2021, 9:55 a.m. OK PyPy 3 TESTS 7 514 19456000 1500
136974390 saurabhbisht D Nov. 26, 2021, 7:54 a.m. OK PyPy 3 TESTS 7 514 22630400 1500
136939829 lemiao12 D Nov. 25, 2021, 6:54 p.m. OK PyPy 3-64 TESTS 7 218 37683200 1500
136945255 nitish420 D Nov. 25, 2021, 8:36 p.m. OK PyPy 3-64 TESTS 7 249 45875200 1500
136941971 Nemisis2.O D Nov. 25, 2021, 7:29 p.m. OK PyPy 3-64 TESTS 7 265 44646400 1500
136942108 rivnam D Nov. 25, 2021, 7:32 p.m. OK PyPy 3-64 TESTS 7 280 44646400 1500
137052743 Mystic_heap D Nov. 26, 2021, 3:44 p.m. OK PyPy 3-64 TESTS 7 311 53657600 1500
136960921 IkshitG D Nov. 26, 2021, 4:39 a.m. OK PyPy 3-64 TESTS 7 358 29286400 1500
136941858 Nemisis2.O D Nov. 25, 2021, 7:27 p.m. OK PyPy 3-64 TESTS 7 374 50995200 1500
136973863 laplce D Nov. 26, 2021, 7:46 a.m. OK PyPy 3-64 TESTS 7 452 31539200 1500
136979814 MIRE D Nov. 26, 2021, 9 a.m. OK PyPy 3-64 TESTS 7 467 34201600 1500
136951849 armsusman D Nov. 26, 2021, 12:54 a.m. OK PyPy 3-64 TESTS 7 468 63897600 1500
136947356 OLOGY D Nov. 25, 2021, 9:36 p.m. OK Python 2 TESTS 7 389 27750400 1500
136947176 OLOGY D Nov. 25, 2021, 9:30 p.m. OK Python 2 TESTS 7 420 30617600 1500
137056480 NS3081992 D Nov. 26, 2021, 4:32 p.m. OK Python 3 TESTS 7 343 28467200 1500
137082505 YMSeah D Nov. 27, 2021, 3:37 a.m. OK Python 3 TESTS 7 421 32153600 1500
136936033 kalandar D Nov. 25, 2021, 6:01 p.m. OK Python 3 TESTS 7 452 27648000 1500
136979337 OLOGY D Nov. 26, 2021, 8:54 a.m. OK Python 3 TESTS 7 467 28467200 1500
137055740 NS3081992 D Nov. 26, 2021, 4:24 p.m. OK Python 3 TESTS 7 467 41779200 1500
137055891 NS3081992 D Nov. 26, 2021, 4:25 p.m. OK Python 3 TESTS 7 483 41574400 1500
136947651 OLOGY D Nov. 25, 2021, 9:45 p.m. OK Python 3 TESTS 7 499 28467200 1500
136947533 OLOGY D Nov. 25, 2021, 9:42 p.m. OK Python 3 TESTS 7 499 28467200 1500
136989143 ta2612 D Nov. 26, 2021, 11:07 a.m. OK Python 3 TESTS 7 514 28467200 1500
136979751 OLOGY D Nov. 26, 2021, 8:59 a.m. OK Python 3 TESTS 7 514 29900800 1500
136944856 sansen D Nov. 25, 2021, 8:28 p.m. OK Rust TESTS 7 124 21708800 1500

remove filters

Back to search problems