Codeforces Round 778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round)

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
1654 Codeforces Round 778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round) FINISHED False 8100 89403863 March 20, 2022, 11:35 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2883 ) D Potion Brewing Class PROGRAMMING dfs and similar implementation math number theory trees 2100

B'Alice 's potion making professor gave the following assignment to his students: brew a potion using n ingredients, such that the proportion of ingredient i in the final potion is r_i > 0 (and r_1 + r_2 + cdots + r_n = 1 ). He forgot the recipe, and now all he remembers is a set of n-1 facts of the form, "ingredients i and j should have a ratio of x to y " (i.e., if a_i and a_j are the amounts of ingredient i and j in the potion respectively, then it must hold a_i/a_j = x/y ), where x and y are positive integers. However, it is guaranteed that the set of facts he remembers is sufficient to uniquely determine the original values r_i . He decided that he will allow the students to pass the class as long as they submit a potion which satisfies all of the n-1 requirements (there may be many such satisfactory potions), and contains a positive integer amount of each ingredient. Find the minimum total amount of ingredients needed to make a potion which passes the class. As the result can be very large, you should print the answer modulo 998 ,244 ,353 . The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 ). Each of the next n-1 lines contains four integers i, j, x, y ( 1 <= i, j <= n , i not=j , 1 <= x, y <= n ) -- ingredients i and j should have a ratio of x to y . It is guaranteed that the set of facts is sufficient to uniquely determine the original values r_i . It is also guaranteed that the sum of n for all test cases does not exceed 2 cdot 10^5 . For each test case, print the minimum total amount of ingredients needed to make a potion which passes the class, modulo 998 ,244 ,353 . In the first test case, the minimum total amount of'...

Tutorials

Editorial of Codeforces Round #778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
150263436 Hoshizora_Z D March 20, 2022, 1:15 p.m. OK GNU C++14 TESTS 29 295 25088000 2100
150316715 0wuming0 D March 21, 2022, 3:07 a.m. OK GNU C++14 TESTS 29 296 20070400 2100
150268385 cunzai_zsy0531 D March 20, 2022, 1:38 p.m. OK GNU C++14 TESTS 29 327 82432000 2100
150326363 liuxiangbin D March 21, 2022, 6:01 a.m. OK GNU C++14 TESTS 29 358 30617600 2100
150266122 _ICEY_ D March 20, 2022, 1:28 p.m. OK GNU C++14 TESTS 29 358 42803200 2100
150267781 ladderplayer D March 20, 2022, 1:35 p.m. OK GNU C++14 TESTS 29 374 22835200 2100
150261416 Fizzmy D March 20, 2022, 1:05 p.m. OK GNU C++14 TESTS 29 389 29900800 2100
150314166 Carey_Knight D March 21, 2022, 1:54 a.m. OK GNU C++14 TESTS 29 389 35020800 2100
150319541 zhouxp D March 21, 2022, 4:21 a.m. OK GNU C++14 TESTS 29 390 33280000 2100
150263495 NewInTown D March 20, 2022, 1:15 p.m. OK GNU C++14 TESTS 29 405 22835200 2100
150310379 yangzhanyu D March 20, 2022, 11:46 p.m. OK GNU C++17 TESTS 29 311 127692800 2100
150290401 forgothandle D March 20, 2022, 5:25 p.m. OK GNU C++17 TESTS 29 327 30617600 2100
150317934 zja601 D March 21, 2022, 3:40 a.m. OK GNU C++17 TESTS 29 374 25088000 2100
150278265 kimoyami D March 20, 2022, 3:14 p.m. OK GNU C++17 TESTS 29 374 33587200 2100
150312042 xiaoxiangfeizi D March 21, 2022, 12:39 a.m. OK GNU C++17 TESTS 29 389 23654400 2100
150315991 blank_monster D March 21, 2022, 2:49 a.m. OK GNU C++17 TESTS 29 389 28160000 2100
150313203 newhar D March 21, 2022, 1:18 a.m. OK GNU C++17 TESTS 29 390 31436800 2100
150283344 Nson D March 20, 2022, 4:05 p.m. OK GNU C++17 TESTS 29 420 25088000 2100
150318632 zja601 D March 21, 2022, 3:57 a.m. OK GNU C++17 TESTS 29 420 35737600 2100
150291104 vrobert D March 20, 2022, 5:32 p.m. OK GNU C++17 TESTS 29 420 40960000 2100
150266167 Mofashaoye3 D March 20, 2022, 1:28 p.m. OK GNU C++17 (64) TESTS 29 280 85504000 2100
150314077 CharlesWuQiushi D March 21, 2022, 1:51 a.m. OK GNU C++17 (64) TESTS 29 295 64614400 2100
150325732 YXx315 D March 21, 2022, 5:50 a.m. OK GNU C++17 (64) TESTS 29 311 31232000 2100
150296177 ianahao D March 20, 2022, 6:38 p.m. OK GNU C++17 (64) TESTS 29 311 36044800 2100
150279331 YYYLLL2021 D March 20, 2022, 3:24 p.m. OK GNU C++17 (64) TESTS 29 311 38604800 2100
150315263 Hanasaki D March 21, 2022, 2:29 a.m. OK GNU C++17 (64) TESTS 29 327 43622400 2100
150313294 Artemis_Bow D March 21, 2022, 1:23 a.m. OK GNU C++17 (64) TESTS 29 343 36761600 2100
150275747 EncodeTalker D March 20, 2022, 2:53 p.m. OK GNU C++17 (64) TESTS 29 343 40140800 2100
150267353 antguz D March 20, 2022, 1:33 p.m. OK GNU C++17 (64) TESTS 29 358 34304000 2100
150295321 ianahao D March 20, 2022, 6:26 p.m. OK GNU C++17 (64) TESTS 29 373 35840000 2100
150286478 Tatsuyaaaa D March 20, 2022, 4:40 p.m. OK GNU C++20 (64) TESTS 29 295 49356800 2100
150308989 pzc2004 D March 20, 2022, 11 p.m. OK GNU C++20 (64) TESTS 29 296 42598400 2100
150309029 pzc2004 D March 20, 2022, 11:01 p.m. OK GNU C++20 (64) TESTS 29 311 42598400 2100
150277029 ItayOtto D March 20, 2022, 3:03 p.m. OK GNU C++20 (64) TESTS 29 327 36454400 2100
150309075 pzc2004 D March 20, 2022, 11:02 p.m. OK GNU C++20 (64) TESTS 29 327 42598400 2100
150317853 hialine D March 21, 2022, 3:37 a.m. OK GNU C++20 (64) TESTS 29 327 44032000 2100
150319312 _NLogN_ D March 21, 2022, 4:15 a.m. OK GNU C++20 (64) TESTS 29 327 62668800 2100
150281001 yizhiyezi D March 20, 2022, 3:41 p.m. OK GNU C++20 (64) TESTS 29 343 43622400 2100
150296641 preet_25 D March 20, 2022, 6:45 p.m. OK GNU C++20 (64) TESTS 29 343 55910400 2100
150276621 mehtaji D March 20, 2022, 3 p.m. OK GNU C++20 (64) TESTS 29 358 43622400 2100
150311093 dzhi D March 21, 2022, 12:08 a.m. OK Java 11 TESTS 29 1060 61440000 2100
150305402 pepelats D March 20, 2022, 9:21 p.m. OK Java 11 TESTS 29 1528 136192000 2100
150284908 Restricted D March 20, 2022, 4:22 p.m. OK Java 11 TESTS 29 1809 150630400 2100
150295120 NatInTheHat D March 20, 2022, 6:23 p.m. OK Java 8 TESTS 29 2183 158310400 2100
150267310 LXl491214 D March 20, 2022, 1:33 p.m. OK MS C++ 2017 TESTS 29 639 20377600 2100
150269529 r57shell D March 20, 2022, 1:43 p.m. OK MS C++ 2017 TESTS 29 764 22732800 2100
150319715 notTehlka D March 21, 2022, 4:26 a.m. OK PyPy 3 TESTS 29 1887 122675200 2100
150325956 lemiao12 D March 21, 2022, 5:54 a.m. OK PyPy 3 TESTS 29 2089 140902400 2100
150281074 manish.17 D March 20, 2022, 3:41 p.m. OK PyPy 3 TESTS 29 2183 104140800 2100
150319706 notTehlka D March 21, 2022, 4:25 a.m. OK PyPy 3-64 TESTS 29 2994 190361600 2100
150267215 notnotTehlka D March 20, 2022, 1:33 p.m. OK PyPy 3-64 TESTS 29 2994 190361600 2100
150289764 Spheniscine D March 20, 2022, 5:17 p.m. OK Rust 2021 TESTS 29 233 77619200 2100
150289273 Spheniscine D March 20, 2022, 5:12 p.m. OK Rust 2021 TESTS 29 233 77619200 2100

remove filters

Back to search problems