Codeforces Round 892 (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
1859 Codeforces Round 892 (Div. 2) FINISHED False 7200 45329063 Aug. 12, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1843 ) E Maximum Monogonosity PROGRAMMING brute force dp math

B'You are given an array a of length n and an array b of length n . The cost of a segment [l, r] , 1 <= l <= r <= n , is defined as |b_l - a_r| + |b_r - a_l| . Recall that two segments [l_1, r_1] , 1 <= l_1 <= r_1 <= n , and [l_2, r_2] , 1 <= l_2 <= r_2 <= n , are non-intersecting if one of the following conditions is satisfied: r_1 < l_2 or r_2 < l_1 . The length of a segment [l, r] , 1 <= l <= r <= n , is defined as r - l + 1 . Find the maximum possible sum of costs of non-intersecting segments [l_j, r_j] , 1 <= l_j <= r_j <= n , whose total length is equal to k . Each test consists of multiple test cases. The first line contains a single integer t (1 <= t <= 1000) -- the number of sets of input data. The description of the test cases follows. The first line of each test case contains two integers n and k ( 1 <= k <= n <= 3000 ) -- the length of array a and the total length of segments. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( -10^9 <= a_i <= 10^9 ) -- the elements of array a . The third line of each test case contains n integers b_1, b_2, ldots, b_n ( -10^9 <= b_i <= 10^9 ) -- the elements of array b . It is guaranteed that the sum of n over all test case does not exceed 3000 . For each test case, output a single number -- the maximum possible sum of costs of such segments. In the first test case, the cost of any segment is 0 , so the total cost is 0 . In the second test case, we can take the segment [1, 1] with a cost of 8 and the segment [3, 3] with a cost of 2 to get a total sum of 10 . It can be shown that this is the optimal solution. In the third test case, we are only interested in segments of length 1 , and the cost of any such segment is 0 . In the f'...

Tutorials

Video solutions from Geothermal.

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
218615641 Aurora0915 E Aug. 13, 2023, 2:07 a.m. OK GNU C++14 TESTS 31 46 1126400
218580622 cun_thich_lap_trinh E Aug. 12, 2023, 5:12 p.m. OK GNU C++14 TESTS 31 62 72704000
218625200 LOOP0 E Aug. 13, 2023, 4:56 a.m. OK GNU C++14 TESTS 31 78 72396800
218618106 zhang_yt E Aug. 13, 2023, 2:56 a.m. OK GNU C++14 TESTS 31 93 72499200
218610407 zdc431487 E Aug. 12, 2023, 11:44 p.m. OK GNU C++14 TESTS 31 93 72601600
218580030 szflc E Aug. 12, 2023, 5:09 p.m. OK GNU C++14 TESTS 31 93 72601600
218624467 gcfer E Aug. 13, 2023, 4:45 a.m. OK GNU C++14 TESTS 31 93 72704000
218580438 cun_thich_lap_trinh E Aug. 12, 2023, 5:11 p.m. OK GNU C++14 TESTS 31 108 72704000
218615957 AquaWaveCJLD E Aug. 13, 2023, 2:13 a.m. OK GNU C++14 TESTS 31 108 72806400
218592431 yydtq E Aug. 12, 2023, 6:35 p.m. OK GNU C++14 TESTS 31 109 72499200
218596834 adbjesus E Aug. 12, 2023, 7:25 p.m. OK GNU C++17 TESTS 31 46 204800
218627871 Absolutey E Aug. 13, 2023, 5:33 a.m. OK GNU C++17 TESTS 31 77 72499200
218595301 SpaceJellyfish E Aug. 12, 2023, 7:07 p.m. OK GNU C++17 TESTS 31 93 72192000
218612682 lyx123886a123886 E Aug. 13, 2023, 12:59 a.m. OK GNU C++17 TESTS 31 93 72601600
218620476 kevco E Aug. 13, 2023, 3:41 a.m. OK GNU C++17 TESTS 31 93 72704000
218592647 Ant_Man E Aug. 12, 2023, 6:37 p.m. OK GNU C++17 TESTS 31 109 102400
218628551 SGColin E Aug. 13, 2023, 5:42 a.m. OK GNU C++17 TESTS 31 109 204800
218628425 SGColin E Aug. 13, 2023, 5:40 a.m. OK GNU C++17 TESTS 31 109 204800
218582129 szdytom E Aug. 12, 2023, 5:18 p.m. OK GNU C++17 TESTS 31 109 72499200
218585170 otoshigo E Aug. 12, 2023, 5:36 p.m. OK GNU C++17 TESTS 31 124 72601600
218588339 like_a_dream E Aug. 12, 2023, 5:59 p.m. OK GNU C++17 (64) TESTS 31 31 204800
218587852 YocyCraft E Aug. 12, 2023, 5:55 p.m. OK GNU C++17 (64) TESTS 31 46 204800
218622931 panyi E Aug. 13, 2023, 4:22 a.m. OK GNU C++17 (64) TESTS 31 61 72499200
218623840 panyi E Aug. 13, 2023, 4:35 a.m. OK GNU C++17 (64) TESTS 31 62 72499200
218628987 Once_I_Liked_AGirl E Aug. 13, 2023, 5:48 a.m. OK GNU C++17 (64) TESTS 31 77 72704000
218586303 ilovevoi E Aug. 12, 2023, 5:44 p.m. OK GNU C++17 (64) TESTS 31 77 72806400
218580022 kondasujay2 E Aug. 12, 2023, 5:09 p.m. OK GNU C++17 (64) TESTS 31 78 204800
218616384 chfychin E Aug. 13, 2023, 2:21 a.m. OK GNU C++17 (64) TESTS 31 93 204800
218621720 cjoa E Aug. 13, 2023, 4:02 a.m. OK GNU C++17 (64) TESTS 31 93 72499200
218619828 secret-550504 E Aug. 13, 2023, 3:28 a.m. OK GNU C++17 (64) TESTS 31 93 72499200
218616058 learner__ E Aug. 13, 2023, 2:15 a.m. OK GNU C++20 (64) TESTS 31 31 204800
218626583 riverwalk7 E Aug. 13, 2023, 5:16 a.m. OK GNU C++20 (64) TESTS 31 46 204800
218604416 Meloric E Aug. 12, 2023, 9:14 p.m. OK GNU C++20 (64) TESTS 31 46 204800
218586033 Ckcyi E Aug. 12, 2023, 5:42 p.m. OK GNU C++20 (64) TESTS 31 46 204800
218618566 RGB_ICPC3 E Aug. 13, 2023, 3:05 a.m. OK GNU C++20 (64) TESTS 31 46 72499200
218585684 guangmingzhengda E Aug. 12, 2023, 5:39 p.m. OK GNU C++20 (64) TESTS 31 46 72704000
218584090 hqmm E Aug. 12, 2023, 5:29 p.m. OK GNU C++20 (64) TESTS 31 46 289382400
218625507 mQfZ E Aug. 13, 2023, 5 a.m. OK GNU C++20 (64) TESTS 31 62 204800
218597402 HoshinoAi E Aug. 12, 2023, 7:32 p.m. OK GNU C++20 (64) TESTS 31 62 204800
218589738 kaiboy E Aug. 12, 2023, 6:11 p.m. OK GNU C++20 (64) TESTS 31 62 204800
218609851 maxK99 E Aug. 12, 2023, 11:26 p.m. OK MS C++ 2017 TESTS 31 93 72294400
218598550 zouyu9631 E Aug. 12, 2023, 7:46 p.m. OK PyPy 3-64 TESTS 31 499 10854400
218583451 zouyu9631 E Aug. 12, 2023, 5:25 p.m. OK PyPy 3-64 TESTS 31 560 94310400
218598130 zouyu9631 E Aug. 12, 2023, 7:40 p.m. OK PyPy 3-64 TESTS 31 561 93388800
218597011 zouyu9631 E Aug. 12, 2023, 7:27 p.m. OK PyPy 3-64 TESTS 31 608 93593600
218582230 Little_Sheep_Yawn E Aug. 12, 2023, 5:18 p.m. OK PyPy 3-64 TESTS 31 920 14438400
218584809 yuki_keshiki E Aug. 12, 2023, 5:33 p.m. OK PyPy 3-64 TESTS 31 982 13107200
218589355 kostylevGO E Aug. 12, 2023, 6:08 p.m. OK Rust 2021 TESTS 31 187 72704000

remove filters

Back to search problems