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 |
---|---|---|---|---|---|---|
1764 | Codeforces Global Round 24 | FINISHED | False | 9000 | 62351699 | Nov. 26, 2022, 2:05 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 193 ) | H | Doremy's Paint 2 | PROGRAMMING | data structures |
B'Doremy has n buckets of paint which is represented by an array a of length n . Bucket i contains paint with color a_i . Initially, a_i=i . Doremy has m segments [l_i,r_i] ( 1 <= l_i <= r_i <= n ). Each segment describes an operation. Operation i is performed as follows: Doremy also selects an integer k . She wants to know for each integer x from 0 to m-1 , the number of distinct colors in the array after performing operations x bmod m +1, (x+1) bmod m + 1, ldots, (x+k-1) bmod m +1 . Can you help her calculate these values? Note that for each x individually we start from the initial array and perform only the given k operations in the given order. The first line of input contains three integers n , m , and k ( 1 <= n,m <= 2 cdot 10^5 , 1 <= k <= m ) -- the length of the array a , the total number of operations, and the integer that Doremy selects. The i -th line of the following m lines contains two integers l_i , r_i ( 1 <= l_i <= r_i <= n ) -- the bounds of the i -th segment. Output m integers. The (x+1) -th integer should be the number of distinct colors in the array if we start from the initial array and perform operations x bmod m +1, (x+1) bmod m + 1, ldots, (x+k-1) bmod m +1 . In the first test case, the picture below shows the resulting array for the values of x=0,1,2 respectively. '... |
Codeforces Global Round 24 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
182709023 | rainboy | H | Nov. 26, 2022, 6:05 p.m. | OK | GNU C11 | TESTS | 51 | 3072 | 221184000 | ||
182690996 | Miracle0viiiiiv | H | Nov. 26, 2022, 3:54 p.m. | OK | GNU C++17 | TESTS | 51 | 639 | 9523200 | ||
182702581 | pashka | H | Nov. 26, 2022, 5:05 p.m. | OK | GNU C++17 | TESTS | 51 | 873 | 12288000 | ||
182722936 | ynsm | H | Nov. 26, 2022, 9:14 p.m. | OK | GNU C++17 | TESTS | 51 | 3712 | 248934400 | ||
182726739 | ynsm | H | Nov. 26, 2022, 10:30 p.m. | OK | GNU C++17 | TESTS | 51 | 3743 | 247296000 | ||
182684846 | QAQAutoMaton | H | Nov. 26, 2022, 3:27 p.m. | OK | GNU C++17 (64) | TESTS | 51 | 1809 | 80179200 | ||
182702530 | farhanLabib2537 | H | Nov. 26, 2022, 5:05 p.m. | OK | GNU C++17 (64) | TESTS | 51 | 1809 | 80179200 | ||
182696889 | ecnerwala | H | Nov. 26, 2022, 4:23 p.m. | OK | GNU C++20 (64) | TESTS | 51 | 654 | 25190400 | ||
182710873 | ecnerwala | H | Nov. 26, 2022, 6:20 p.m. | OK | GNU C++20 (64) | TESTS | 51 | 685 | 25190400 | ||
182712172 | ecnerwala | H | Nov. 26, 2022, 6:34 p.m. | OK | GNU C++20 (64) | TESTS | 51 | 732 | 22016000 | ||
182711861 | noob_coder2007 | H | Nov. 26, 2022, 6:30 p.m. | OK | GNU C++20 (64) | TESTS | 51 | 764 | 14540800 | ||
182732463 | dragonslayerintraining | H | Nov. 27, 2022, 1:31 a.m. | OK | GNU C++20 (64) | TESTS | 51 | 888 | 13516800 | ||
182732560 | dragonslayerintraining | H | Nov. 27, 2022, 1:35 a.m. | OK | GNU C++20 (64) | TESTS | 51 | 920 | 13516800 | ||
182694344 | Vercingetorix | H | Nov. 26, 2022, 4:10 p.m. | OK | GNU C++20 (64) | TESTS | 51 | 1091 | 14540800 | ||
182690443 | maroonrk | H | Nov. 26, 2022, 3:52 p.m. | OK | GNU C++20 (64) | TESTS | 51 | 1309 | 132096000 | ||
182694935 | jiangly | H | Nov. 26, 2022, 4:13 p.m. | OK | GNU C++20 (64) | TESTS | 51 | 2214 | 80588800 |
Back to search problems