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 |
|---|---|---|---|---|---|---|
| 2185 | Codeforces Round 1074 (Div. 4) | FINISHED | False | 8100 | 7658723 | Jan. 18, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 662 ) | H | BattleCows 2 | PROGRAMMING | binary search brute force data structures greedy |
Farmer John wants to host another tournament with (n) cows, where the (i)-th cow has a skill level of (a_i). The following process repeats until there is only one cow in the line. The first cow in the line fights the second cow in the line, and the cow with the higher skill level wins. If there is a tie, the first cow wins. The winning cow's skill level is set to (x + y), where (x) is the skill level of the winning cow and (y) is the skill level of the losing cow. The losing cow leaves the line. However, to maintain accuracy to the real USACOW competition, a cow is able to cheat up to (k) times. This means that even if it loses the match, Farmer John will treat it as if the losing cow won the match, meaning that the losing cow's skill level will be set to (x + y), where (x) is the skill level of the winning cow and (y) is the skill level of the losing cow, and the winning cow will leave the line. A position (x) is good for a cow (i) if cow (i) can be removed from its original position and inserted at index (x) without changing the order of the other cows and be the only cow remaining in the line once the tournament has ended, assuming no other cow cheats. For each cow in the line, calculate the number of good positions for that cow. The first line of the input contains a single integer (t) ((1 \leq t \leq 10^4)) — the number of test cases. The first line of each test case contains two integers (n) and (k) ((2 \le n \le 2 \cdot 10^5), (0 \leq k < n)) — the number of cows and the number of cheats a cow can use. The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 10^9)) — the skill levels of the cows. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output (n) integers, where the (i)-th integer denotes the number of good positions for cow (i). For the first test ca |
| Codeforces Round 1074 (Div. 4) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 358652548 | Harigton | H | Jan. 18, 2026, 7:08 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 171 | 8192000 | ||
| 358634798 | Anuj_Sharma03 | H | Jan. 18, 2026, 4:49 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 171 | 8192000 | ||
| 358632358 | abhyudaichauhan | H | Jan. 18, 2026, 4:46 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 171 | 8192000 | ||
| 358632011 | Shikhar_Gangwar | H | Jan. 18, 2026, 4:45 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 171 | 8192000 | ||
| 358631553 | kumarabhishek.dev | H | Jan. 18, 2026, 4:44 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 171 | 8192000 | ||
| 358629703 | tai.vinhdn05 | H | Jan. 18, 2026, 4:42 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 203 | 8192000 | ||
| 358640544 | kylin0610 | H | Jan. 18, 2026, 5:19 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 218 | 5222400 | ||
| 358656697 | _Filya_ | H | Jan. 18, 2026, 8:09 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 281 | 0 | ||
| 358666378 | AntiBsayer | H | Jan. 19, 2026, 1:02 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 593 | 2457600 | ||
| 358640970 | Kareem_Elgoker | H | Jan. 18, 2026, 5:22 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 1437 | 148787200 | ||
| 358654860 | wakanda-forever | H | Jan. 18, 2026, 7:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 78 | 102400 | ||
| 358642717 | beiyuli | H | Jan. 18, 2026, 5:34 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 93 | 102400 | ||
| 358636445 | PaperCloud | H | Jan. 18, 2026, 4:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 125 | 102400 | ||
| 358651135 | Yzm007 | H | Jan. 18, 2026, 6:51 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 125 | 1126400 | ||
| 358635586 | A.R.Y.A.N.18 | H | Jan. 18, 2026, 4:49 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 140 | 8192000 | ||
| 358632590 | meow20040908 | H | Jan. 18, 2026, 4:46 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 140 | 8908800 | ||
| 358629365 | Hayashi | H | Jan. 18, 2026, 4:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 156 | 102400 | ||
| 358633480 | mady9613 | H | Jan. 18, 2026, 4:47 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 156 | 11878400 | ||
| 358633363 | Caylex | H | Jan. 18, 2026, 4:47 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 156 | 17920000 | ||
| 358645068 | ji_114514 | H | Jan. 18, 2026, 5:53 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 171 | 3276800 | ||
| 358662556 | 415411 | H | Jan. 18, 2026, 10:26 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 46 | 3788800 | ||
| 358662484 | 415411 | H | Jan. 18, 2026, 10:23 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 78 | 1638400 | ||
| 358662539 | 415411 | H | Jan. 18, 2026, 10:25 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 93 | 1638400 | ||
| 358665884 | 415411 | H | Jan. 19, 2026, 12:43 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 93 | 3276800 | ||
| 358649863 | 415411 | H | Jan. 18, 2026, 6:37 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 93 | 3276800 | ||
| 358650529 | Leelasai_2004 | H | Jan. 18, 2026, 6:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 109 | 0 | ||
| 358649683 | momohara | H | Jan. 18, 2026, 6:35 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 109 | 1024000 | ||
| 358656057 | mahiro_zcy | H | Jan. 18, 2026, 7:59 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 109 | 4608000 | ||
| 358650383 | mahiro_zcy | H | Jan. 18, 2026, 6:43 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 109 | 4608000 | ||
| 358650294 | mahiro_zcy | H | Jan. 18, 2026, 6:41 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 109 | 4608000 | ||
| 358635249 | Ahan_Mourya | H | Jan. 18, 2026, 4:49 p.m. | OK | Java 21 | TESTS | 25 | 593 | 18534400 | ||
| 358686372 | hitman_py | H | Jan. 19, 2026, 6:06 a.m. | OK | PyPy 3-64 | TESTS | 25 | 375 | 26726400 | ||
| 358659299 | kaushik.atla | H | Jan. 18, 2026, 8:59 p.m. | OK | PyPy 3-64 | TESTS | 25 | 671 | 56012800 | ||
| 358628679 | yesmorewaterplease | H | Jan. 18, 2026, 4:40 p.m. | OK | PyPy 3-64 | TESTS | 25 | 859 | 42905600 | ||
| 358681685 | IcyGirl | H | Jan. 19, 2026, 5:19 a.m. | OK | PyPy 3-64 | TESTS | 25 | 1296 | 30412800 | ||
| 358637187 | EchooHM | H | Jan. 18, 2026, 4:58 p.m. | OK | Python 3 | TESTS | 25 | 2062 | 131584000 |
Back to search problems