Codeforces Round 875 (Div. 1)

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
1830 Codeforces Round 875 (Div. 1) FINISHED False 9000 51895463 May 28, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 266 ) F The Third Grace PROGRAMMING data structures dp

B'You are given n intervals and m points on the number line. The i -th intervals covers coordinates [l_i,r_i] and the i -th point is on coordinate i and has coefficient p_i . Initially, all points are not activated. You should choose a subset of the m points to activate. For each of n interval, we define its cost as: Your task is to maximize the sum of the costs of all intervals by choosing which points to activate. Each test contains multiple test cases. The first line of input contains a single integer t ( 1 <= t <= 10^5 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains two integers n and m ( 1 <= n <= 10^6, 1 <= m <= 10^6 ) -- the number of intervals and the number of points. The following n lines of each test case contains two integers l_i and r_i ( 1 <= l_i <= r_i <= m ) -- the endpoints of the i -th interval. The following line of each test case contains m integers p_1,p_2, ldots,p_m ( 0 <= p_i <= 10^9 ) -- the coefficients of the points. It is guaranteed that the sum of n does not exceed 10^6 and the sum of m does not exceed 10^6 . Output the maximum possible sum of costs of all intervals. In the first sample, we can activate points 1 and 8 . The sum of costs of all intervals will be 78+30=108 . In the second sample, we will activate no points. The sum of costs of all intervals will be 0 . '...

Tutorials

Codeforces Round #875 (Div.1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
207697662 ko_osaga F May 29, 2023, 2:23 a.m. OK GNU C++20 (64) TESTS 46 2760 152473600
207688166 iliya7 F May 28, 2023, 9:37 p.m. OK GNU C++20 (64) TESTS 46 2885 233267200
207675579 Sputnik1234 F May 28, 2023, 6:22 p.m. OK GNU C++20 (64) TESTS 46 2979 233267200
207652053 Ormlis F May 28, 2023, 4:24 p.m. OK GNU C++20 (64) TESTS 46 2979 233267200
207663837 1a2b3c4 F May 28, 2023, 4:55 p.m. OK GNU C++20 (64) TESTS 46 3946 180531200
207678271 -0.5 F May 28, 2023, 6:51 p.m. OK GNU C++20 (64) TESTS 46 4461 212787200

remove filters

Back to search problems