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 |
---|---|---|---|---|---|---|
1630 | Codeforces Round 768 (Div. 1) | FINISHED | False | 7200 | 93972263 | Jan. 27, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1688 ) | D | Flipping Range | PROGRAMMING | dp greedy number theory |
B"You are given an array a of n integers and a set B of m positive integers such that 1 <= q b_i <= q lfloor frac{n}{2} rfloor for 1 <= i <= m , where b_i is the i -th element of B . You can make the following operation on a : Consider the following example, let a=[0,6,-2,1,-4,5] and B= {1,2 } : Find the maximum sum limits_{i=1}^n {a_i} you can get after applying such operation any number of times (possibly zero). The input consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^5 ) -- the number of test cases. Description of the test cases follows. The first line of each test case contains two integers n and m ( 2 <= q n <= q 10^6 , 1 <= q m <= q lfloor frac{n}{2} rfloor ) -- the number of elements of a and B respectively. The second line of each test case contains n integers a_1,a_2, ldots,a_n ( -10^9 <= q a_i <= q 10^9 ). The third line of each test case contains m distinct positive integers b_1,b_2, ldots,b_m ( 1 <= q b_i <= q lfloor frac{n}{2} rfloor ) -- the elements in the set B . It's guaranteed that the sum of n over all test cases does not exceed 10^6 . For each test case print a single integer -- the maximum possible sum of all a_i after applying such operation any number of times. In the first test, you can apply the operation x=1 , l=3 , r=3 , and the operation x=1 , l=5 , r=5 , then the array becomes [0, 6, 2, 1, 4, 5] . In the second test, you can apply the operation x=2 , l=2 , r=3 , and the array becomes [1, 1, -1, -1, 1, -1, 1] , then apply the operation x=2 , l=3 , r=4 , and the array becomes [1, 1, 1, 1, 1, -1, 1] . There is no way to achieve a sum bigger than 5 . "... |
Editorial of Codeforces Round #768 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
144222856 | Gassa | D | Jan. 27, 2022, 3:43 p.m. | OK | D | TESTS | 35 | 467 | 60825600 | ||
144236953 | osmanorhan | D | Jan. 27, 2022, 4:11 p.m. | OK | GNU C++14 | TESTS | 35 | 342 | 7987200 | ||
144242733 | eecs | D | Jan. 27, 2022, 4:23 p.m. | OK | GNU C++14 | TESTS | 35 | 342 | 24064000 | ||
144236897 | sys. | D | Jan. 27, 2022, 4:11 p.m. | OK | GNU C++14 | TESTS | 35 | 343 | 9011200 | ||
144238628 | 275307894a | D | Jan. 27, 2022, 4:14 p.m. | OK | GNU C++14 | TESTS | 35 | 343 | 11980800 | ||
144241350 | Timsei | D | Jan. 27, 2022, 4:20 p.m. | OK | GNU C++14 | TESTS | 35 | 343 | 13004800 | ||
144230051 | meyi | D | Jan. 27, 2022, 3:56 p.m. | OK | GNU C++14 | TESTS | 35 | 358 | 3993600 | ||
144275351 | cwhfy | D | Jan. 28, 2022, 3:11 a.m. | OK | GNU C++14 | TESTS | 35 | 358 | 9011200 | ||
144255438 | Igorfardoc | D | Jan. 27, 2022, 6:40 p.m. | OK | GNU C++14 | TESTS | 35 | 373 | 3993600 | ||
144225343 | AdaptiveControl | D | Jan. 27, 2022, 3:47 p.m. | OK | GNU C++14 | TESTS | 35 | 373 | 10035200 | ||
144254292 | nishkarsh | D | Jan. 27, 2022, 6:32 p.m. | OK | GNU C++14 | TESTS | 35 | 373 | 10342400 | ||
144244437 | fallleaves01 | D | Jan. 27, 2022, 4:27 p.m. | OK | GNU C++17 | TESTS | 35 | 93 | 20172800 | ||
144243129 | CE_WA_TLE | D | Jan. 27, 2022, 4:24 p.m. | OK | GNU C++17 | TESTS | 35 | 109 | 38400000 | ||
144234856 | CQXYM | D | Jan. 27, 2022, 4:06 p.m. | OK | GNU C++17 | TESTS | 35 | 249 | 6451200 | ||
144242745 | OMG_link | D | Jan. 27, 2022, 4:23 p.m. | OK | GNU C++17 | TESTS | 35 | 280 | 24473600 | ||
144274236 | hotwords | D | Jan. 28, 2022, 2:47 a.m. | OK | GNU C++17 | TESTS | 35 | 343 | 3993600 | ||
144218397 | amethyst0 | D | Jan. 27, 2022, 3:35 p.m. | OK | GNU C++17 | TESTS | 35 | 343 | 3993600 | ||
144278095 | Kirito | D | Jan. 28, 2022, 4:02 a.m. | OK | GNU C++17 | TESTS | 35 | 373 | 7987200 | ||
144256514 | Kilani | D | Jan. 27, 2022, 6:51 p.m. | OK | GNU C++17 | TESTS | 35 | 374 | 3993600 | ||
144228777 | YaoBIG | D | Jan. 27, 2022, 3:54 p.m. | OK | GNU C++17 | TESTS | 35 | 374 | 10342400 | ||
144273662 | Smokey_Days | D | Jan. 28, 2022, 2:33 a.m. | OK | GNU C++17 | TESTS | 35 | 374 | 16076800 | ||
144272388 | Kubic | D | Jan. 28, 2022, 1:59 a.m. | OK | GNU C++17 (64) | TESTS | 35 | 62 | 5017600 | ||
144242392 | fengchang | D | Jan. 27, 2022, 4:23 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 62 | 7065600 | ||
144204010 | maroonrk | D | Jan. 27, 2022, 3:14 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 62 | 8089600 | ||
144204729 | QAQAutoMaton | D | Jan. 27, 2022, 3:15 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 92 | 36249600 | ||
144223870 | PetelgeuseRomaneeconti | D | Jan. 27, 2022, 3:45 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 171 | 57344000 | ||
144234371 | froggyzhang | D | Jan. 27, 2022, 4:05 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 248 | 7987200 | ||
144222258 | Xellos | D | Jan. 27, 2022, 3:42 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 249 | 7987200 | ||
144205842 | stevenkplus | D | Jan. 27, 2022, 3:16 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 249 | 7987200 | ||
144275568 | kitsune | D | Jan. 28, 2022, 3:16 a.m. | OK | GNU C++17 (64) | TESTS | 35 | 249 | 10035200 | ||
144210123 | noimi | D | Jan. 27, 2022, 3:22 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 249 | 10035200 | ||
144256131 | maxplus | D | Jan. 27, 2022, 6:47 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 61 | 3993600 | ||
144216890 | Vercingetorix | D | Jan. 27, 2022, 3:33 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 61 | 9113600 | ||
144258064 | maxplus | D | Jan. 27, 2022, 7:07 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 62 | 3993600 | ||
144257906 | maxplus | D | Jan. 27, 2022, 7:05 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 62 | 3993600 | ||
144257750 | maxplus | D | Jan. 27, 2022, 7:03 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 62 | 3993600 | ||
144257308 | maxplus | D | Jan. 27, 2022, 6:58 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 62 | 3993600 | ||
144255995 | maxplus | D | Jan. 27, 2022, 6:46 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 62 | 3993600 | ||
144259465 | maxplus | D | Jan. 27, 2022, 7:23 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 77 | 3993600 | ||
144256673 | maxplus | D | Jan. 27, 2022, 6:52 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 78 | 3993600 | ||
144256550 | maxplus | D | Jan. 27, 2022, 6:51 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 78 | 3993600 | ||
144234278 | 0x3F | D | Jan. 27, 2022, 4:05 p.m. | OK | Go | TESTS | 35 | 919 | 12697600 | ||
144242126 | clyring | D | Jan. 27, 2022, 4:22 p.m. | OK | Haskell | TESTS | 35 | 701 | 91443200 | ||
144268824 | barkat03 | D | Jan. 27, 2022, 11:30 p.m. | OK | Java 11 | TESTS | 35 | 779 | 88166400 | ||
144269102 | barkat03 | D | Jan. 27, 2022, 11:45 p.m. | OK | Java 11 | TESTS | 35 | 982 | 81203200 | ||
144257056 | MagentaCobra | D | Jan. 27, 2022, 6:56 p.m. | OK | Java 8 | TESTS | 35 | 421 | 0 | ||
144265720 | YahiaSherif | D | Jan. 27, 2022, 9:24 p.m. | OK | Java 8 | TESTS | 35 | 670 | 88985600 | ||
144257272 | whatshisbucket | D | Jan. 27, 2022, 6:58 p.m. | OK | Java 8 | TESTS | 35 | 919 | 87347200 | ||
144277931 | Hakiobo | D | Jan. 28, 2022, 3:59 a.m. | OK | Kotlin 1.4 | TESTS | 35 | 1169 | 93696000 | ||
144243011 | ComPhyPark | D | Jan. 27, 2022, 4:24 p.m. | OK | MS C++ 2017 | TESTS | 35 | 436 | 8089600 | ||
144266615 | OLOGY | D | Jan. 27, 2022, 9:50 p.m. | OK | PyPy 2 | TESTS | 35 | 1325 | 77209600 | ||
144265847 | OLOGY | D | Jan. 27, 2022, 9:27 p.m. | OK | PyPy 2 | TESTS | 35 | 1481 | 77824000 | ||
144263972 | OLOGY | D | Jan. 27, 2022, 8:39 p.m. | OK | PyPy 2 | TESTS | 35 | 1574 | 77824000 | ||
144264833 | OLOGY | D | Jan. 27, 2022, 8:59 p.m. | OK | PyPy 2 | TESTS | 35 | 1684 | 77824000 | ||
144256510 | NecroSean38 | D | Jan. 27, 2022, 6:51 p.m. | OK | PyPy 3 | TESTS | 35 | 763 | 117657600 | ||
144256376 | FlakeLCR | D | Jan. 27, 2022, 6:49 p.m. | OK | PyPy 3 | TESTS | 35 | 795 | 117145600 | ||
144230805 | FlakeLCR | D | Jan. 27, 2022, 3:58 p.m. | OK | PyPy 3 | TESTS | 35 | 888 | 117145600 | ||
144273206 | whatshisbucket | D | Jan. 28, 2022, 2:21 a.m. | OK | PyPy 3 | TESTS | 35 | 1481 | 82944000 | ||
144210851 | conqueror_of_tourist | D | Jan. 27, 2022, 3:23 p.m. | OK | PyPy 3 | TESTS | 35 | 1513 | 82636800 | ||
144256499 | Dremov | D | Jan. 27, 2022, 6:50 p.m. | OK | PyPy 3 | TESTS | 35 | 1575 | 91033600 | ||
144231611 | titia | D | Jan. 27, 2022, 4 p.m. | OK | PyPy 3 | TESTS | 35 | 1684 | 89190400 | ||
144256860 | akhan42 | D | Jan. 27, 2022, 6:54 p.m. | OK | PyPy 3 | TESTS | 35 | 1747 | 84889600 | ||
144255443 | akhan42 | D | Jan. 27, 2022, 6:41 p.m. | OK | PyPy 3 | TESTS | 35 | 1996 | 87244800 | ||
144266666 | OLOGY | D | Jan. 27, 2022, 9:51 p.m. | OK | Python 2 | TESTS | 35 | 1606 | 68812800 | ||
144266626 | OLOGY | D | Jan. 27, 2022, 9:50 p.m. | OK | Python 2 | TESTS | 35 | 1700 | 68812800 | ||
144273227 | whatshisbucket | D | Jan. 28, 2022, 2:22 a.m. | OK | Python 3 | TESTS | 35 | 1372 | 77312000 | ||
144209450 | Egor | D | Jan. 27, 2022, 3:21 p.m. | OK | Rust 2021 | TESTS | 35 | 93 | 11980800 | ||
144225180 | sansen | D | Jan. 27, 2022, 3:47 p.m. | OK | Rust 2021 | TESTS | 35 | 187 | 61132800 |
Back to search problems