Codeforces Round 687 (Div. 1, based on Technocup 2021 Elimination Round 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
1456 Codeforces Round 687 (Div. 1, based on Technocup 2021 Elimination Round 2) FINISHED False 7200 125189699 Nov. 29, 2020, 7:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 286 ) E XOR-ranges PROGRAMMING dp

B"Given integers c_{0}, c_{1}, ldots, c_{k-1} we can define the cost of a number 0 <= x < 2^{k} as p(x) = sum_{i=0}^{k-1} <= ft( <= ft lfloor frac{x}{2^{i}} right rfloor bmod 2 right) cdot c_{i} . In other words, the cost of number x is the sum of c_{i} over the bits of x which are equal to one. Let's define the cost of array a of length n ge 2 with elements from [0, 2^{k}) as follows: cost(a) = sum_{i=1}^{n - 1} p(a_{i} oplus a_{i+1}) , where oplus denotes bitwise exclusive OR operation. You have to construct an array of length n with minimal cost, given that each element should belong to the given segment: l_{i} <= a_{i} <= r_{i} . The first line contains two integers n and k ( 2 <= n <= 50 , 1 <= k <= 50 ) -- the size of an array and bit length of the numbers in question. Next n lines contain the restrictions for elements of the array: the i -th line contains two integers l_{i} and r_{i} ( 0 <= l_{i} <= r_{i} < 2^{k} ). The last line contains integers c_{0}, c_{1}, ldots, c_{k-1} ( 0 <= c_{i} <= 10^{12} ). Output one integer -- the minimal cost of an array satisfying all the restrictions. In the first example there is only one array satisfying all the restrictions -- [3, 5, 6, 1] -- and its cost is equal to cost([3, 5, 6, 1]) = p(3 oplus 5) + p(5 oplus 6) + p(6 oplus 1) = p(6) + p(3) + p(7) = (c_{1} + c_{2}) + (c_{0} + c_{1}) + (c_{0} + c_{1} + c_{2}) = (2 + 7) + (5 + 2) + (5 + 2 + 7) = 30 . In the second example the only optimal array is [2, 3, 6] . "...

Tutorials

Editorial of Codeforces Round 687 (Technocup 2021 — Elimitation Round 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
99875872 ilnil E Nov. 29, 2020, 8:26 a.m. OK GNU C++11 TESTS 53 109 5427200
99943442 mocania E Nov. 30, 2020, 12:13 a.m. OK GNU C++11 TESTS 53 124 13619200
99889816 jijiang E Nov. 29, 2020, 9:57 a.m. OK GNU C++14 TESTS 53 140 21401600
99940722 Lance_The_Dragon_Trainer E Nov. 29, 2020, 11:11 p.m. OK GNU C++14 TESTS 53 156 21401600
99918553 7aidara.cp E Nov. 29, 2020, 2:49 p.m. OK GNU C++17 TESTS 53 530 22118400
99930929 sh1194 E Nov. 29, 2020, 6:11 p.m. OK GNU C++17 TESTS 53 592 22118400
99954051 jiangly E Nov. 30, 2020, 5:15 a.m. OK GNU C++17 (64) TESTS 53 78 4608000
99945782 ecnerwala E Nov. 30, 2020, 12:44 a.m. OK GNU C++17 (64) TESTS 53 93 204800
99945769 ecnerwala E Nov. 30, 2020, 12:44 a.m. OK GNU C++17 (64) TESTS 53 93 204800
99943961 ecnerwala E Nov. 30, 2020, 12:39 a.m. OK GNU C++17 (64) TESTS 53 93 307200
99943904 ecnerwala E Nov. 30, 2020, 12:37 a.m. OK GNU C++17 (64) TESTS 53 202 307200
99943880 ecnerwala E Nov. 30, 2020, 12:35 a.m. OK GNU C++17 (64) TESTS 53 249 307200
99943557 al13n E Nov. 30, 2020, 12:19 a.m. OK GNU C++17 (64) TESTS 53 249 18739200
99889188 Cyanic E Nov. 29, 2020, 9:53 a.m. OK GNU C++17 (64) TESTS 53 467 22118400
99873391 ecnerwala E Nov. 29, 2020, 8:18 a.m. OK GNU C++17 (64) TESTS 53 717 17100800
99925827 Benq E Nov. 29, 2020, 4:37 p.m. OK GNU C++17 (64) TESTS 53 904 47308800

remove filters

Back to search problems