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.
Problems
B"Students of one unknown college don't have PE courses. That's why q of them decided to visit a gym nearby by themselves. The gym is open for n days and has a ticket system. At the i -th day, the cost of one ticket is equal to a_i . You are free to buy more than one ticket per day. You can activate a ticket purchased at day i either at day i or any day later. Each activated ticket is valid only for k days. In other words, if you activate ticket at day t , it will be valid only at days t, t + 1, ... , t + k - 1 . You know that the j -th student wants to visit the gym at each day from l_j to r_j inclusive. Each student will use the following strategy of visiting the gym at any day i ( l_j <= i <= r_j ): Note that each student will visit gym only starting l_j , so each student has to buy at least one ticket at day l_j . Help students to calculate the minimum amount of money they have to spend in order to go to the gym. The first line contains three integers n , q and k ( 1 <= n, q <= 300 ,000 ; 1 <= k <= n ) -- the number of days, the number of students and the number of days each ticket is still valid. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ) -- the cost of one ticket at the corresponding day. Each of the next q lines contains two integers l_i and r_i ( 1 <= l_i <= r_i <= n ) -- the segment of days the corresponding student want to visit the gym. For each student, print the minimum possible amount of money they have to spend in order to go to the gym at desired days. Let's see how each student have to spend their money: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
133092278 |
rainboy |
E |
Oct. 25, 2021, 5:08 p.m. |
OK |
GNU C11 |
TESTS |
23 |
1575 |
14540800 |
|
2900 |
133067359 |
wsyhb |
E |
Oct. 25, 2021, 1:29 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
373 |
74547200 |
|
2900 |
133020344 |
tianbu |
E |
Oct. 25, 2021, 8:17 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
405 |
55808000 |
|
2900 |
133065837 |
acniu |
E |
Oct. 25, 2021, 1:13 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
483 |
39936000 |
|
2900 |
133026677 |
Mr_Wu |
E |
Oct. 25, 2021, 8:26 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
483 |
44032000 |
|
2900 |
133012509 |
Radewoosh |
E |
Oct. 25, 2021, 7:58 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
498 |
99942400 |
|
2900 |
133029069 |
inaFSTream |
E |
Oct. 25, 2021, 8:27 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
514 |
58572800 |
|
2900 |
133061455 |
AlexWangr |
E |
Oct. 25, 2021, 12:31 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
530 |
59801600 |
|
2900 |
133061356 |
AlexWangr |
E |
Oct. 25, 2021, 12:31 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
530 |
59904000 |
|
2900 |
133020556 |
RobeZH |
E |
Oct. 25, 2021, 8:18 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
545 |
65638400 |
|
2900 |
133067669 |
TanakaAsuka |
E |
Oct. 25, 2021, 1:32 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
577 |
67788800 |
|
2900 |
133023042 |
izone |
E |
Oct. 25, 2021, 8:19 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
327 |
28569600 |
|
2900 |
133091630 |
anodiebird |
E |
Oct. 25, 2021, 5 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
421 |
73830400 |
|
2900 |
133116546 |
windy7926778 |
E |
Oct. 26, 2021, 3:18 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
451 |
29900800 |
|
2900 |
133012503 |
djq_cpp |
E |
Oct. 25, 2021, 7:58 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
498 |
22425600 |
|
2900 |
133118590 |
KillerX |
E |
Oct. 26, 2021, 4:10 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
530 |
43417600 |
|
2900 |
133124085 |
Isonan |
E |
Oct. 26, 2021, 5:53 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
576 |
65638400 |
|
2900 |
133010165 |
ko_osaga |
E |
Oct. 25, 2021, 7:53 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
638 |
93081600 |
|
2900 |
133037487 |
armoking |
E |
Oct. 25, 2021, 9:09 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
639 |
50688000 |
|
2900 |
133080158 |
lucaperju |
E |
Oct. 25, 2021, 3:33 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
670 |
118579200 |
|
2900 |
133019338 |
2om_neek |
E |
Oct. 25, 2021, 8:12 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
686 |
55193600 |
|
2900 |
133112909 |
zjjws |
E |
Oct. 26, 2021, 1:30 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
296 |
97792000 |
|
2900 |
133023455 |
never_giveup |
E |
Oct. 25, 2021, 8:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
358 |
38297600 |
|
2900 |
133092296 |
rainboy |
E |
Oct. 25, 2021, 5:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
389 |
11980800 |
|
2900 |
133009950 |
maroonrk |
E |
Oct. 25, 2021, 7:52 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
436 |
90624000 |
|
2900 |
133031363 |
Froggay |
E |
Oct. 25, 2021, 8:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
514 |
65638400 |
|
2900 |
133037406 |
hzkmd |
E |
Oct. 25, 2021, 9:08 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
529 |
49152000 |
|
2900 |
133020733 |
fextivity |
E |
Oct. 25, 2021, 8:19 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
530 |
62054400 |
|
2900 |
133060767 |
hiddenStudent |
E |
Oct. 25, 2021, 12:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
530 |
119500800 |
|
2900 |
133051983 |
Alan233 |
E |
Oct. 25, 2021, 10:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
592 |
36761600 |
|
2900 |
133051897 |
Alan233 |
E |
Oct. 25, 2021, 10:58 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
592 |
36864000 |
|
2900 |
133108237 |
Linkus |
E |
Oct. 25, 2021, 10:02 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
265 |
125644800 |
|
2900 |
133042646 |
Linkus |
E |
Oct. 25, 2021, 9:30 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
280 |
79769600 |
|
2900 |
133078111 |
BlueDiamond |
E |
Oct. 25, 2021, 3:09 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
327 |
32768000 |
|
2900 |
133010446 |
Ormlis |
E |
Oct. 25, 2021, 7:54 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
343 |
51916800 |
|
2900 |
133074611 |
syl123456 |
E |
Oct. 25, 2021, 2:46 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
467 |
66764800 |
|
2900 |
133040523 |
Linkus |
E |
Oct. 25, 2021, 9:22 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
483 |
79769600 |
|
2900 |
133093123 |
atodo |
E |
Oct. 25, 2021, 5:18 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
514 |
64409600 |
|
2900 |
133113245 |
frame233 |
E |
Oct. 26, 2021, 1:41 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
545 |
26009600 |
|
2900 |
133070283 |
Nero |
E |
Oct. 25, 2021, 1:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
655 |
71168000 |
|
2900 |
133060786 |
BOT_SaNyA |
E |
Oct. 25, 2021, 12:25 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
655 |
94720000 |
|
2900 |
remove filters
Back to search problems