Codeforces Round 818 (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
1717 Codeforces Round 818 (Div. 2) FINISHED False 7200 75050663 Sept. 2, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 543 ) F Madoka and The First Session PROGRAMMING constructive algorithms dfs and similar flows graph matchings graphs 2500

B'Oh no, on the first exam Madoka got this hard problem: Given integer n and m pairs of integers ( v_i, u_i ). Also there is an array b_1, b_2, ldots, b_n , initially filled with zeros. Then for each index i , where 1 <= q i <= q m , perform either b_{v_i} := b_{v_i} - 1 and b_{u_i} := b_{u_i} + 1 , or b_{v_i} := b_{v_i} + 1 and b_{u_i} := b_{u_i} - 1 . Note that exactly one of these operations should be performed for every i . Also there is an array s of length n consisting of 0 and 1 . And there is an array a_1, a_2, ldots, a_n , where it is guaranteed, that if s_i = 0 holds, then a_i = 0 . Help Madoka and determine whenever it is possible to perform operations in such way that for every i , where s_i = 1 it holds that a_i = b_i . If it possible you should also provide Madoka with a way to perform operations. The first line contains two integers n and m ( 2 <= q n <= q 10000, 1 <= q m <= q 10000 ) -- the length of the array a and the number of pair of integers. The second line contains n integers s_1, s_2, ldots s_n ( 0 <= s_i <= 1 ) -- the elements of the array s . The third line contains n integers a_1, a_2, ldots, a_n ( |a_i| <= q m ) -- the elements of the array a . It is guaranteed that if s_i = 0 holds, then a_i = 0 . i -th of the following m lines contains two integers v_i and u_i ( 1 <= q v_i, u_i <= q n, v_i ne u_i ) -- the indexes of the elements of the array b to which the operation is performed. It is also guaranteed that there are no two indices i and j , where 1 <= i < j <= m , such that (v_i, u_i) = (v_j, u_j) or (v_i, u_i) = (u_j, v_j) . In the first line print "YES" if it is possible to perform operations in the required way, and "NO" otherwise. You may print each letter in any case '...

Tutorials

Codeforces Round #818 (Div. 2) Editorial.

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
170672166 rainboy F Sept. 2, 2022, 9:28 p.m. OK GNU C11 TESTS 77 77 1331200 2500
170639769 Multiplicative F Sept. 2, 2022, 4:17 p.m. OK GNU C++14 TESTS 60 30 1740800 2500
170696613 jumpmelon F Sept. 3, 2022, 5:51 a.m. OK GNU C++14 TESTS 87 31 2662400 2500
170688672 zlsim F Sept. 3, 2022, 3:54 a.m. OK GNU C++14 TESTS 86 31 3584000 2500
170640982 zmj2008AKIOI F Sept. 2, 2022, 4:20 p.m. OK GNU C++14 TESTS 60 31 15564800 2500
170692111 Xu_Hongxi F Sept. 3, 2022, 4:52 a.m. OK GNU C++14 TESTS 87 46 1024000 2500
170690052 themoon F Sept. 3, 2022, 4:19 a.m. OK GNU C++14 TESTS 86 46 1536000 2500
170644252 xtzic F Sept. 2, 2022, 4:28 p.m. OK GNU C++14 TESTS 60 46 1945600 2500
170687762 grass8cow F Sept. 3, 2022, 3:34 a.m. OK GNU C++14 TESTS 86 46 2355200 2500
170649552 hokarikanae F Sept. 2, 2022, 4:53 p.m. OK GNU C++14 TESTS 60 46 3276800 2500
170686918 L7-56 F Sept. 3, 2022, 3:20 a.m. OK GNU C++14 TESTS 86 46 4300800 2500
170642114 algebraist F Sept. 2, 2022, 4:23 p.m. OK GNU C++17 TESTS 60 15 1536000 2500
170652515 Devil_G F Sept. 2, 2022, 5:14 p.m. OK GNU C++17 TESTS 60 30 3993600 2500
170665656 kbp12 F Sept. 2, 2022, 7:37 p.m. OK GNU C++17 TESTS 67 31 1228800 2500
170641731 Sweezyk F Sept. 2, 2022, 4:22 p.m. OK GNU C++17 TESTS 60 31 1331200 2500
170685690 abc864197532 F Sept. 3, 2022, 2:58 a.m. OK GNU C++17 TESTS 86 46 1228800 2500
170645836 TristeanimaCZY F Sept. 2, 2022, 4:32 p.m. OK GNU C++17 TESTS 60 46 1536000 2500
170683937 xjq F Sept. 3, 2022, 2:26 a.m. OK GNU C++17 TESTS 86 46 1638400 2500
170641815 Marckess F Sept. 2, 2022, 4:22 p.m. OK GNU C++17 TESTS 60 46 2764800 2500
170679642 Samsara_soul F Sept. 3, 2022, 12:42 a.m. OK GNU C++17 TESTS 79 46 2867200 2500
170640846 _horikita_suzune F Sept. 2, 2022, 4:20 p.m. OK GNU C++17 TESTS 60 46 3276800 2500
170641292 InoueTakina F Sept. 2, 2022, 4:21 p.m. OK GNU C++17 (64) TESTS 60 31 1638400 2500
170639605 kotatsugame F Sept. 2, 2022, 4:16 p.m. OK GNU C++17 (64) TESTS 60 31 2662400 2500
170644191 siganai F Sept. 2, 2022, 4:28 p.m. OK GNU C++17 (64) TESTS 60 31 5324800 2500
170674063 iLLusio F Sept. 2, 2022, 10:16 p.m. OK GNU C++17 (64) TESTS 77 31 8908800 2500
170644468 catalyst_test F Sept. 2, 2022, 4:29 p.m. OK GNU C++17 (64) TESTS 60 31 9216000 2500
170688859 leexzq F Sept. 3, 2022, 3:57 a.m. OK GNU C++17 (64) TESTS 86 62 3276800 2500
170642998 DuRen13 F Sept. 2, 2022, 4:25 p.m. OK GNU C++17 (64) TESTS 60 62 9625600 2500
170642577 liouzhou_101 F Sept. 2, 2022, 4:24 p.m. OK GNU C++20 (64) TESTS 60 15 5529600 2500
170686548 leafeon F Sept. 3, 2022, 3:13 a.m. OK GNU C++20 (64) TESTS 86 15 6963200 2500
170643717 MatrixCascade_qwq F Sept. 2, 2022, 4:27 p.m. OK GNU C++20 (64) TESTS 60 15 217292800 2500
170646638 A_G F Sept. 2, 2022, 4:34 p.m. OK GNU C++20 (64) TESTS 60 30 4096000 2500
170692699 _Enigma__ F Sept. 3, 2022, 5:01 a.m. OK GNU C++20 (64) TESTS 87 30 7475200 2500
170682880 SolarPea F Sept. 3, 2022, 2:04 a.m. OK GNU C++20 (64) TESTS 86 31 1536000 2500
170682736 xay5421 F Sept. 3, 2022, 2 a.m. OK GNU C++20 (64) TESTS 86 31 1536000 2500
170688062 jiangly F Sept. 3, 2022, 3:41 a.m. OK GNU C++20 (64) TESTS 86 31 1536000 2500
170649334 oldyan F Sept. 2, 2022, 4:52 p.m. OK GNU C++20 (64) TESTS 60 31 2457600 2500
170685947 leafeon F Sept. 3, 2022, 3:03 a.m. OK GNU C++20 (64) TESTS 86 31 2457600 2500
170654177 arvindf232 F Sept. 2, 2022, 5:28 p.m. OK Kotlin 1.6 TESTS 60 280 6348800 2500
170652879 misorin F Sept. 2, 2022, 5:17 p.m. OK PyPy 3 TESTS 60 779 24883200 2500
170642918 bjin F Sept. 2, 2022, 4:25 p.m. OK Rust 2021 TESTS 60 30 5836800 2500

remove filters

Back to search problems