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 |
---|---|---|---|---|---|---|
1537 | Codeforces Round 726 (Div. 2) | FINISHED | False | 7200 | 107796299 | June 18, 2021, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 2491 ) | F | Figure Fixing | PROGRAMMING | constructive algorithms dfs and similar ds graphs math |
B'You have a connected undirected graph made of n nodes and m edges. The i -th node has a value v_i and a target value t_i . In an operation, you can choose an edge (i, j) and add k to both v_i and v_j , where k can be any integer. In particular, k can be negative. Your task to determine if it is possible that by doing some finite number of operations (possibly zero), you can achieve for every node i , v_i = t_i . The first line contains a single integer t ( 1 <= q t <= q 1000 ), the number of test cases. Then the test cases follow. The first line of each test case contains two integers n , m ( 2 <= q n <= q 2 cdot 10^5 , n-1 <= q m <= q min(2 cdot 10^5, frac{n(n-1)}{2}) ) -- the number of nodes and edges respectively. The second line contains n integers v_1 ldots, v_n ( -10^9 <= q v_i <= q 10^9 ) -- initial values of nodes. The third line contains n integers t_1 ldots, t_n ( -10^9 <= q t_i <= q 10^9 ) -- target values of nodes. Each of the next m lines contains two integers i and j representing an edge between node i and node j ( 1 <= q i, j <= q n , i ne j ). It is guaranteed that the graph is connected and there is at most one edge between the same pair of nodes. It is guaranteed that the sum of n over all testcases does not exceed 2 cdot 10^5 and the sum of m over all testcases does not exceed 2 cdot 10^5 . For each test case, if it is possible for every node to reach its target after some number of operations, print "YES". Otherwise, print "NO". Here is a visualization of the first test case (the orange values denote the initial values and the blue ones the desired values): One possible order of operations to obtain the desired values for each node is the following: Now we can see that in total we added -2 to node 1 , 2 to node 2 , '... |
Codeforces Round #726 (Div.2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
119944285 | pipixia2019 | F | June 19, 2021, 4:08 a.m. | OK | GNU C++11 | TESTS | 37 | 46 | 6451200 | ||
119931394 | myx12345 | F | June 18, 2021, 10:19 p.m. | OK | GNU C++11 | TESTS | 37 | 46 | 27238400 | ||
119945654 | _Josh__ | F | June 19, 2021, 4:27 a.m. | OK | GNU C++11 | TESTS | 37 | 61 | 15155200 | ||
119939297 | Pointy | F | June 19, 2021, 2:48 a.m. | OK | GNU C++11 | TESTS | 37 | 62 | 9420800 | ||
119941472 | chiyo | F | June 19, 2021, 3:24 a.m. | OK | GNU C++11 | TESTS | 37 | 62 | 14438400 | ||
119936123 | SongsEnteringDream | F | June 19, 2021, 1:42 a.m. | OK | GNU C++11 | TESTS | 37 | 62 | 22118400 | ||
119941749 | GSHgsh | F | June 19, 2021, 3:29 a.m. | OK | GNU C++11 | TESTS | 37 | 77 | 9216000 | ||
119951771 | Talentkkggg | F | June 19, 2021, 5:36 a.m. | OK | GNU C++11 | TESTS | 37 | 77 | 10035200 | ||
119952958 | huan_yp | F | June 19, 2021, 5:47 a.m. | OK | GNU C++11 | TESTS | 37 | 77 | 10547200 | ||
119952528 | REYwmp | F | June 19, 2021, 5:43 a.m. | OK | GNU C++11 | TESTS | 37 | 78 | 7270400 | ||
119943413 | tyagivaibhav | F | June 19, 2021, 3:55 a.m. | OK | GNU C++14 | TESTS | 37 | 218 | 10444800 | ||
119943912 | ngpin04 | F | June 19, 2021, 4:02 a.m. | OK | GNU C++14 | TESTS | 37 | 218 | 10752000 | ||
119949250 | BlackRain | F | June 19, 2021, 5:09 a.m. | OK | GNU C++14 | TESTS | 37 | 218 | 11468800 | ||
119929926 | mat_v | F | June 18, 2021, 9:31 p.m. | OK | GNU C++14 | TESTS | 37 | 218 | 11776000 | ||
119929674 | maxcruickshanks | F | June 18, 2021, 9:24 p.m. | OK | GNU C++14 | TESTS | 37 | 233 | 10752000 | ||
119943259 | incomprehensive | F | June 19, 2021, 3:52 a.m. | OK | GNU C++14 | TESTS | 37 | 233 | 13004800 | ||
119933447 | ilijaIR1331IR | F | June 19, 2021, 12:13 a.m. | OK | GNU C++14 | TESTS | 37 | 233 | 14540800 | ||
119939382 | akhandagrwl_19 | F | June 19, 2021, 2:49 a.m. | OK | GNU C++14 | TESTS | 37 | 233 | 36966400 | ||
119949798 | eexyz | F | June 19, 2021, 5:15 a.m. | OK | GNU C++14 | TESTS | 37 | 234 | 11776000 | ||
119930675 | Kal-El | F | June 18, 2021, 9:54 p.m. | OK | GNU C++14 | TESTS | 37 | 234 | 16384000 | ||
119936292 | Qza_AC | F | June 19, 2021, 1:45 a.m. | OK | GNU C++17 | TESTS | 37 | 202 | 8499200 | ||
119929653 | g1phy | F | June 18, 2021, 9:23 p.m. | OK | GNU C++17 | TESTS | 37 | 217 | 12492800 | ||
119932793 | ShJ | F | June 18, 2021, 11:32 p.m. | OK | GNU C++17 | TESTS | 37 | 218 | 9318400 | ||
119928112 | AlbertoTDNeto | F | June 18, 2021, 8:46 p.m. | OK | GNU C++17 | TESTS | 37 | 218 | 10137600 | ||
119919214 | kuchnahihorahahai | F | June 18, 2021, 6:48 p.m. | OK | GNU C++17 | TESTS | 37 | 218 | 10137600 | ||
119937076 | Je-O | F | June 19, 2021, 2:04 a.m. | OK | GNU C++17 | TESTS | 37 | 218 | 11161600 | ||
119940312 | 1127193030 | F | June 19, 2021, 3:06 a.m. | OK | GNU C++17 | TESTS | 37 | 218 | 11776000 | ||
119927152 | vkgainz | F | June 18, 2021, 8:27 p.m. | OK | GNU C++17 | TESTS | 37 | 218 | 12185600 | ||
119926798 | Serenity1517 | F | June 18, 2021, 8:21 p.m. | OK | GNU C++17 | TESTS | 37 | 218 | 12595200 | ||
119925154 | BigF | F | June 18, 2021, 7:54 p.m. | OK | GNU C++17 | TESTS | 37 | 218 | 13209600 | ||
119948192 | Parsa84 | F | June 19, 2021, 4:58 a.m. | OK | GNU C++17 (64) | TESTS | 37 | 171 | 11571200 | ||
119952454 | EnTeR_SaNdMaN1000101 | F | June 19, 2021, 5:42 a.m. | OK | GNU C++17 (64) | TESTS | 37 | 171 | 14028800 | ||
119917051 | blin00 | F | June 18, 2021, 6:30 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 171 | 16179200 | ||
119938488 | SW2000 | F | June 19, 2021, 2:34 a.m. | OK | GNU C++17 (64) | TESTS | 37 | 186 | 10752000 | ||
119929836 | Jorge213 | F | June 18, 2021, 9:28 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 186 | 11571200 | ||
119928777 | nsns | F | June 18, 2021, 9 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 186 | 11571200 | ||
119921537 | moo. | F | June 18, 2021, 7:09 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 186 | 13209600 | ||
119930030 | zerver52 | F | June 18, 2021, 9:33 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 186 | 14131200 | ||
119917258 | blin00 | F | June 18, 2021, 6:31 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 186 | 15257600 | ||
119944724 | Tatsuyaaaa | F | June 19, 2021, 4:14 a.m. | OK | GNU C++17 (64) | TESTS | 37 | 186 | 16076800 | ||
119940165 | 0x3F | F | June 19, 2021, 3:03 a.m. | OK | Go | TESTS | 37 | 77 | 9932800 | ||
119940078 | 0x3F | F | June 19, 2021, 3:02 a.m. | OK | Go | TESTS | 37 | 93 | 10035200 | ||
119918123 | 0x3F | F | June 18, 2021, 6:37 p.m. | OK | Go | TESTS | 37 | 514 | 10956800 | ||
119929583 | Sandip_Jana | F | June 18, 2021, 9:22 p.m. | OK | Java 11 | TESTS | 37 | 498 | 33689600 | ||
119935655 | hu_tao | F | June 19, 2021, 1:30 a.m. | OK | Java 8 | TESTS | 37 | 358 | 33689600 | ||
119930857 | augurar | F | June 18, 2021, 10 p.m. | OK | Java 8 | TESTS | 37 | 483 | 41062400 | ||
119921842 | golions | F | June 18, 2021, 7:12 p.m. | OK | Java 8 | TESTS | 37 | 561 | 45056000 | ||
119950329 | aggarwalanshul01 | F | June 19, 2021, 5:20 a.m. | OK | Java 8 | TESTS | 37 | 873 | 63590400 | ||
119919304 | Hakiobo | F | June 18, 2021, 6:50 p.m. | OK | Kotlin | TESTS | 37 | 592 | 39628800 | ||
119923839 | gevak | F | June 18, 2021, 7:35 p.m. | OK | MS C++ | TESTS | 37 | 780 | 15462400 | ||
119923500 | xsc | F | June 18, 2021, 7:31 p.m. | OK | MS C++ 2017 | TESTS | 37 | 280 | 10035200 | ||
119936973 | Hitik | F | June 19, 2021, 2:02 a.m. | OK | PyPy 2 | TESTS | 37 | 1808 | 26726400 | ||
119926354 | silvertint | F | June 18, 2021, 8:13 p.m. | OK | PyPy 3 | TESTS | 37 | 935 | 26214400 | ||
119948828 | Klaycf | F | June 19, 2021, 5:05 a.m. | OK | PyPy 3 | TESTS | 37 | 951 | 26726400 | ||
119948010 | vwxyz0 | F | June 19, 2021, 4:56 a.m. | OK | PyPy 3 | TESTS | 37 | 1185 | 41676800 | ||
119949198 | vwxyz0 | F | June 19, 2021, 5:08 a.m. | OK | PyPy 3 | TESTS | 37 | 1201 | 42086400 | ||
119948077 | vwxyz0 | F | June 19, 2021, 4:57 a.m. | OK | PyPy 3 | TESTS | 37 | 1216 | 38604800 | ||
119949256 | vwxyz0 | F | June 19, 2021, 5:09 a.m. | OK | PyPy 3 | TESTS | 37 | 1247 | 44646400 |
Back to search problems