Codeforces Round 1044 (Div. 2)

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
2133 Codeforces Round 1044 (Div. 2) FINISHED False 7200 20359523 Aug. 24, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 458 ) F Flint and Steel PROGRAMMING data structures dp

Steve's creeper farm has overflowed and there are creepers everywhere! There are (n) creepers standing in a line, with the (i)-th creeper having explosive power (e_i). Steve needs to kill all of them in order to get past. To do this, he can use his trusty Flint and Steel to detonate creepers. Detonating the creeper at position (i) kills all creepers at positions (j) such that (|i - j| < e_i). Dead creepers cannot be detonated. Some creepers may be particularly weak and have explosive power (0), meaning they cannot be detonated either. With the Great Hog hot on his tail, there is no time to waste. Find a sequence of detonations that kills all the creepers with as few detonations as possible, or report it is impossible. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((2 \le n \le 5 \cdot 10^5)) — the number of creepers. The second line of each test case contains (n) integers (e_1, e_2,\ldots, e_n) ((0 \le e_i \le n)) — the explosive power of each creeper. It is guaranteed that the sum of (n) over all test cases does not exceed (5 \cdot 10^5). For each test case, output (-1) if it is impossible to kill all the creepers. Otherwise, output two lines. On the first line, output a single integer (k) ((1 \leq k \leq n)), the minimum number of detonations needed. Then output a line with (k) integers (d_1, d_2, \ldots, d_k) ((1 \leq d_i \leq n)), stating the sequence of creepers to detonate. If there are multiple solutions, you can print any of them. In the first test case, the sequence of detonations is as follows: (\underline{0, \mathbf{2}, 2}, 3, 0, 1) (\times, \underline{\times, \times, \mathbf{3}, 0, 1}) (\times, \times, \times, \times, \times, \times) In the second test case, creeper (1)

Tutorials

Codeforces Round 1044 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
335419906 Dhruthi_MS F Aug. 24, 2025, 8:31 p.m. OK C++17 (GCC 7-32) TESTS 51 483 18534400
335435416 aanamishra2407 F Aug. 25, 2025, 2:40 a.m. OK C++17 (GCC 7-32) TESTS 51 812 40140800
335414294 himadri765 F Aug. 24, 2025, 7:18 p.m. OK C++17 (GCC 7-32) TESTS 51 842 40140800
335440493 BINYU F Aug. 25, 2025, 3:48 a.m. OK C++17 (GCC 7-32) TESTS 51 889 40550400
335421113 Ivan_len F Aug. 24, 2025, 8:51 p.m. OK C++20 (GCC 13-64) TESTS 51 374 37580800
335428975 Noobish_Monk F Aug. 25, 2025, 12:36 a.m. OK C++20 (GCC 13-64) TESTS 51 562 36352000
335406622 StarSilk F Aug. 24, 2025, 6:09 p.m. OK C++20 (GCC 13-64) TESTS 51 671 48947200
335411938 Ab_hoga_real_Cumback F Aug. 24, 2025, 6:54 p.m. OK C++20 (GCC 13-64) TESTS 51 827 47308800
335443719 NelsonCodes F Aug. 25, 2025, 4:41 a.m. OK C++20 (GCC 13-64) TESTS 51 858 47308800
335407512 Intellegent F Aug. 24, 2025, 6:16 p.m. OK C++20 (GCC 13-64) TESTS 51 890 33587200
335409320 OG_Matveychick1 F Aug. 24, 2025, 6:31 p.m. OK C++20 (GCC 13-64) TESTS 51 952 67584000
335392236 Qball F Aug. 24, 2025, 4:23 p.m. OK C++20 (GCC 13-64) TESTS 51 1077 216473600
335423951 galen_colin F Aug. 24, 2025, 9:54 p.m. OK C++20 (GCC 13-64) TESTS 51 1093 180838400
335401871 fogrevelation F Aug. 24, 2025, 5:38 p.m. OK C++20 (GCC 13-64) TESTS 51 1093 236032000
335444519 Nandan_username F Aug. 25, 2025, 4:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 390 18534400
335430370 Hoang_Thien_De F Aug. 25, 2025, 1:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 515 57344000
335402441 wjwweiwei F Aug. 24, 2025, 5:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 51 593 72704000
335401950 not_used11 F Aug. 24, 2025, 5:38 p.m. OK C++23 (GCC 14-64, msys2) TESTS 51 593 72704000
335449625 maspy F Aug. 25, 2025, 5:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 718 30515200
335420421 Frexto F Aug. 24, 2025, 8:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 51 718 58470400
335446313 WTXwang F Aug. 25, 2025, 5:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 827 137728000
335429749 kangyi F Aug. 25, 2025, 1:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 859 47308800
335413951 zzach2009 F Aug. 24, 2025, 7:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 51 859 47308800
335402645 PQath F Aug. 24, 2025, 5:42 p.m. OK C++23 (GCC 14-64, msys2) TESTS 51 859 47308800

remove filters

Back to search problems