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 |
|---|---|---|---|---|---|---|
| 2068 | European Championship 2025 - Online Mirror (Unrated, ICPC Rules, Teams Preferred) | FINISHED | False | 18000 | 35493923 | March 2, 2025, 10:35 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1632 ) | C | Ads | PROGRAMMING | binary search greedy two pointers |
You have (n) videos on your watchlist on the popular platform YooCube. The (i)-th video lasts (d_i) minutes. YooCube has recently increased the frequency of their ads. Ads are shown only between videos. After finishing a video, an ad is shown if either of these two conditions is true: three videos have been watched since the last ad; at least (k) minutes have passed since the end of the last ad. You want to watch the (n) videos in your watchlist. Given that you have just watched an ad, and that you can choose the order of the (n) videos, what is the minimum number of ads that you are forced to watch? You can start a new video immediately after the previous video or ad ends, and you don't have to watch any ad after you finish. Each test contains multiple test cases. The first line contains an integer (t) ((1 \leq t \leq 100\,000)) — the number of test cases. The descriptions of the (t) test cases follow. The first line of each test case contains two integers (n) and (k) ((1 \leq n \leq 100\,000, 1 \leq k \leq 30\,000)) — the number of videos in your watchlist and the parameter that determines when ads are shown. The second line contains (n) integers (d_1, d_2, \ldots, d_n (1 \leq d_i \leq 10\,000)) — the lengths of the videos. The sum of the values of (n) over all test cases does not exceed (10^6). For each test case, print the minimum number of ads that you need to watch. In the first test case , a possible viewing order is (4, 1, 8, 2, 5, 6, 7, 3) (the corresponding lengths being (3, 4, 14, 5, 17, 17, 18, 18)). With this order, you will have to watch an ad after the first three videos and then another after the second three videos. Note that you don't have to watch an ad after you finish watching all your videos. |
| 140239 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 308648484 | LucaLucaM Andrei_ierdnA MateiKing80 | C | March 2, 2025, 12:11 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 233 | 819200 | ||
| 308665637 | enratingion PeruvianCartel khanhdungtrinh | C | March 2, 2025, 2:16 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 265 | 0 | ||
| 308660084 | tfgs | C | March 2, 2025, 1:37 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 265 | 0 | ||
| 308699000 | ay1357 | C | March 2, 2025, 6:53 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 265 | 102400 | ||
| 308650266 | SzinAttila | C | March 2, 2025, 12:25 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 265 | 102400 | ||
| 308665829 | birsnot | C | March 2, 2025, 2:18 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 280 | 102400 | ||
| 308727281 | TadijaSebez | C | March 3, 2025, 1:14 a.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 296 | 409600 | ||
| 308648156 | ARIS2_0 hgcnxn tachanka233 | C | March 2, 2025, 12:09 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 296 | 819200 | ||
| 308647836 | xiaowuc1 | C | March 2, 2025, 12:07 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 312 | 102400 | ||
| 308648075 | YeahPotato umbrella-leaf cdxcdxcdxcdx | C | March 2, 2025, 12:08 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 312 | 409600 | ||
| 308642813 | zhuchenyao www_bilibili_com Donaldqian0712 | C | March 2, 2025, 11:33 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 171 | 512000 | ||
| 308644920 | JDScript0117 | C | March 2, 2025, 11:46 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 186 | 409600 | ||
| 308651031 | goats_9 SaltyDonut weirdflexbutok | C | March 2, 2025, 12:32 p.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 217 | 0 | ||
| 308649391 | Irmuun.Ch | C | March 2, 2025, 12:18 p.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 0 | ||
| 308644589 | tourist | C | March 2, 2025, 11:44 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 0 | ||
| 308643281 | Agreb | C | March 2, 2025, 11:36 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 0 | ||
| 308742869 | alireza_kaviani ymmparsa amirhoseinfar1385 | C | March 3, 2025, 5:52 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 102400 | ||
| 308696143 | DaviHenrique brenner1 jackson.souza | C | March 2, 2025, 6:24 p.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 102400 | ||
| 308640362 | Karuna arnold518 YeongTree | C | March 2, 2025, 11:17 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 102400 | ||
| 308643407 | __jk__ QwertyPi potatoo | C | March 2, 2025, 11:37 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 921600 | ||
| 308642296 | jiangly | C | March 2, 2025, 11:30 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 202 | 0 | ||
| 308691132 | milind0110 | C | March 2, 2025, 5:37 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 102400 | ||
| 308651748 | Misuki Ststone kenkenken | C | March 2, 2025, 12:37 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 102400 | ||
| 308645733 | TyroWhizz Teja-Smart | C | March 2, 2025, 11:52 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 102400 | ||
| 308655232 | Mu_Silk pengpeng_fudan | C | March 2, 2025, 1:03 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 409600 | ||
| 308644259 | StarSilk | C | March 2, 2025, 11:42 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 409600 | ||
| 308724468 | Sparkle_Twilight | C | March 3, 2025, 12:15 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 819200 | ||
| 308723141 | _Kamisato_Ayaka_ | C | March 3, 2025, 12:01 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 819200 | ||
| 308642552 | 244mhq antontrygubO_o | C | March 2, 2025, 11:31 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 233 | 0 | ||
| 308729669 | codechefimcooking | C | March 3, 2025, 2:12 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 234 | 102400 | ||
| 308636205 | arvindf232 Noam527 errorgorn | C | March 2, 2025, 10:50 a.m. | OK | Kotlin 1.9 | TESTS | 10 | 921 | 2560000 | ||
| 308636236 | MongHwa 987 | C | March 2, 2025, 10:50 a.m. | OK | PyPy 3-64 | TESTS | 10 | 406 | 25702400 | ||
| 308641290 | nikoro256 loop0919 harurun4635 | C | March 2, 2025, 11:23 a.m. | OK | PyPy 3-64 | TESTS | 10 | 765 | 21401600 | ||
| 308656789 | vedang_kore Newt_ScAmANdeR grecil | C | March 2, 2025, 1:14 p.m. | OK | PyPy 3-64 | TESTS | 10 | 1234 | 29081600 | ||
| 308648296 | Maksim1744 | C | March 2, 2025, 12:10 p.m. | OK | Rust 2021 | TESTS | 10 | 296 | 307200 |
Back to search problems