Codeforces Round 1031 (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
2113 Codeforces Round 1031 (Div. 2) FINISHED False 7200 26427323 June 15, 2025, 9:05 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 7930 ) C Smilo and Minecraft PROGRAMMING brute force constructive algorithms dp greedy

The boy Smilo is playing Minecraft! To prepare for the battle with the dragon, he needs a lot of golden apples, and for that, he requires a lot of gold. Therefore, Smilo goes to the mine. The mine is a rectangular grid of size (n \times m), where each cell can be either gold ore, stone, or an empty cell. Smilo can blow up dynamite in any empty cell. When dynamite explodes in an empty cell with coordinates ((x, y)), all cells within a square of side (2k + 1) centered at cell ((x, y)) become empty. If gold ore was located strictly inside this square (not on the boundary), it disappears. However, if the gold ore was on the boundary of this square, Smilo collects that gold. Dynamite can only be detonated inside the mine, but the explosion square can extend beyond the mine's boundaries. Determine the maximum amount of gold that Smilo can collect. 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 three integers (n), (m), and (k) ((1 \leq n, m, k \leq 500)) — the number of rows, columns, and the explosion parameter (k), respectively. Each of the following (n) lines contains (m) characters, each of which is equal to '.' , '#' , or 'g' , where '.' — is an empty cell, '#' — is stone, 'g' — is gold. It is guaranteed that at least one of the cells is empty. It is guaranteed that the sum (n \cdot m) across all test cases does not exceed (2.5 \cdot 10^5). For each test case, output a single integer — the maximum amount of gold that can be obtained. In the first test case, Smilo can detonate the dynamite in any empty cell and obtain (2) gold: In the second test case, no matter what Smilo does, he will not be able to obtain any gold: In the third test case, it is possible to detonate the dynamite in the bottom right corner to obtain (2) gold, and then make a

Tutorials

Codeforces Round #1031 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
324516377 uwu12 C June 15, 2025, 11:31 a.m. OK C# 13 TESTS 11 93 5324800
324518132 og.kostya C June 15, 2025, 11:47 a.m. OK C# 13 TESTS 11 109 3174400
324583799 naveenthumati95 C June 16, 2025, 2:39 a.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324561873 theRealChainman C June 15, 2025, 6:21 p.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324559038 gleepglinky C June 15, 2025, 5:51 p.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324547940 abhi_8923 C June 15, 2025, 4:05 p.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324544179 Champion C June 15, 2025, 3:32 p.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324542579 CatsAreCool C June 15, 2025, 3:19 p.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324530646 sandeeprajkanna C June 15, 2025, 1:32 p.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324530051 pushp-raj-mishra C June 15, 2025, 1:26 p.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324529739 practice-id C June 15, 2025, 1:24 p.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324524447 N_Abubakr09 C June 15, 2025, 12:30 p.m. OK C++17 (GCC 7-32) TESTS 11 46 0
324593928 AK0001 C June 16, 2025, 4:51 a.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324581544 tpx-198 C June 16, 2025, 1:55 a.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324579500 hyy_456 C June 16, 2025, 1:10 a.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324565057 Holanda2103 C June 15, 2025, 6:58 p.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324564763 pradeep C June 15, 2025, 6:54 p.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324559166 leo_rc C June 15, 2025, 5:53 p.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324557521 dhruvrajdo005 C June 15, 2025, 5:36 p.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324551882 goelsabhya18 C June 15, 2025, 4:40 p.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324538804 shayak2061 C June 15, 2025, 2:48 p.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324533622 Blazkowicz C June 15, 2025, 2 p.m. OK C++20 (GCC 13-64) TESTS 11 46 0
324595048 tosoPoso C June 16, 2025, 5:08 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324592788 jackylova_fan_fan_fan C June 16, 2025, 4:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324586611 mridulChhipa C June 16, 2025, 3:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324579696 pipipipipi43 C June 16, 2025, 1:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324577425 vikrammalhotra C June 15, 2025, 11:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324577302 S_HAWK_09 C June 15, 2025, 11:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324574337 SANKI C June 15, 2025, 10:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324571178 MeIoN_is_UMP45 C June 15, 2025, 8:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324569923 postmasterr C June 15, 2025, 8:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324569818 .-.-.- C June 15, 2025, 8:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 46 0
324512719 Vicfred C June 15, 2025, 11:04 a.m. OK D TESTS 11 93 10649600
324589259 Brackets12 C June 16, 2025, 3:49 a.m. OK FPC TESTS 11 77 1024000
324525322 Andrew_is_alive C June 15, 2025, 12:38 p.m. OK GNU C11 TESTS 11 62 1228800
324507478 patelyash7224 C June 15, 2025, 10:51 a.m. OK GNU C11 TESTS 11 108 3481600
324511263 mansvi.k C June 15, 2025, 11:01 a.m. OK GNU C11 TESTS 11 311 1331200
324512565 space C June 15, 2025, 11:04 a.m. OK GNU C11 TESTS 11 359 1638400
324506985 k.saijaswanth C June 15, 2025, 10:50 a.m. OK Go TESTS 11 77 4300800
324515461 Balu2907 C June 15, 2025, 11:25 a.m. OK Java 21 TESTS 11 218 409600
324565635 testtest111ksjfrdvn C June 15, 2025, 7:06 p.m. OK Java 21 TESTS 11 233 614400
324516600 PecManO2 C June 15, 2025, 11:33 a.m. OK Java 21 TESTS 11 233 614400
324553431 InfusedParticle C June 15, 2025, 4:55 p.m. OK Java 21 TESTS 11 233 2048000
324537087 barbarian C June 15, 2025, 2:33 p.m. OK Java 21 TESTS 11 249 614400
324507181 Manas_Patil_ C June 15, 2025, 10:51 a.m. OK Java 21 TESTS 11 265 512000
324508275 shrival C June 15, 2025, 10:54 a.m. OK Java 21 TESTS 11 265 921600
324592421 keshav_.agg C June 16, 2025, 4:27 a.m. OK Java 21 TESTS 11 265 1536000
324509807 yashjaiswal2509 C June 15, 2025, 10:58 a.m. OK Java 21 TESTS 11 296 409600
324509556 sad_truant C June 15, 2025, 10:57 a.m. OK Java 21 TESTS 11 296 512000
324515248 tirthgohil1410 C June 15, 2025, 11:23 a.m. OK Java 8 TESTS 11 140 0
324555679 prime29 C June 15, 2025, 5:18 p.m. OK Java 8 TESTS 11 155 0
324597470 xmjlove C June 16, 2025, 5:39 a.m. OK Java 8 TESTS 11 171 0
324510289 sarthaKKharKa_18 C June 15, 2025, 10:59 a.m. OK Java 8 TESTS 11 187 0
324507694 ManasDhakad C June 15, 2025, 10:52 a.m. OK Java 8 TESTS 11 187 0
324507287 Subhashini_gupta C June 15, 2025, 10:51 a.m. OK Java 8 TESTS 11 233 0
324559367 particle_fever C June 15, 2025, 5:55 p.m. OK Java 8 TESTS 11 234 0
324507180 abhijeet29102004 C June 15, 2025, 10:51 a.m. OK Java 8 TESTS 11 249 0
324508664 shivam19_s41 C June 15, 2025, 10:55 a.m. OK Java 8 TESTS 11 265 0
324557902 dhanuboi C June 15, 2025, 5:40 p.m. OK Java 8 TESTS 11 280 0
324509259 eternity_ele C June 15, 2025, 10:56 a.m. OK Node.js TESTS 11 328 15872000
324550264 _Zuno_ C June 15, 2025, 4:25 p.m. OK Node.js TESTS 11 390 13004800
324507691 Yin_yang_69 C June 15, 2025, 10:52 a.m. OK PyPy 3 TESTS 11 328 9830400
324510696 anandxaditya C June 15, 2025, 11 a.m. OK PyPy 3 TESTS 11 546 10444800
324507132 HardikAggarwal45 C June 15, 2025, 10:50 a.m. OK PyPy 3 TESTS 11 640 28569600
324529572 codsila C June 15, 2025, 1:22 p.m. OK PyPy 3 TESTS 11 671 10342400
324534757 Aryanwastaken C June 15, 2025, 2:12 p.m. OK PyPy 3-64 TESTS 11 202 8908800
324529040 alexwice C June 15, 2025, 1:17 p.m. OK PyPy 3-64 TESTS 11 218 8601600
324508113 newdayhere C June 15, 2025, 10:53 a.m. OK PyPy 3-64 TESTS 11 234 18329600
324508280 ShohjahonDadajonov C June 15, 2025, 10:54 a.m. OK PyPy 3-64 TESTS 11 249 11571200
324544404 taowdy C June 15, 2025, 3:34 p.m. OK PyPy 3-64 TESTS 11 249 17100800
324524927 Mischievius C June 15, 2025, 12:34 p.m. OK PyPy 3-64 TESTS 11 249 21299200
324529811 KAMITO C June 15, 2025, 1:24 p.m. OK PyPy 3-64 TESTS 11 265 9625600
324529661 kamitocxy C June 15, 2025, 1:23 p.m. OK PyPy 3-64 TESTS 11 265 9625600
324529855 gardengnome C June 15, 2025, 1:25 p.m. OK PyPy 3-64 TESTS 11 265 9932800
324508669 Remineva C June 15, 2025, 10:55 a.m. OK PyPy 3-64 TESTS 11 280 8704000
324508067 shanks_jr10 C June 15, 2025, 10:53 a.m. OK Python 3 TESTS 11 218 11673600
324508092 CodeAndPizza C June 15, 2025, 10:53 a.m. OK Python 3 TESTS 11 233 11673600
324511395 Anvig23 C June 15, 2025, 11:02 a.m. OK Python 3 TESTS 11 234 11571200
324510127 karthikfirebase22 C June 15, 2025, 10:59 a.m. OK Python 3 TESTS 11 234 11673600
324510056 michalmuha C June 15, 2025, 10:58 a.m. OK Python 3 TESTS 11 249 11468800
324507319 boodaabeep C June 15, 2025, 10:51 a.m. OK Python 3 TESTS 11 249 11673600
324511571 Bommireddy1702 C June 15, 2025, 11:02 a.m. OK Python 3 TESTS 11 265 11571200
324511588 kanhahihu C June 15, 2025, 11:02 a.m. OK Python 3 TESTS 11 265 11673600
324509903 srishtiiii C June 15, 2025, 10:58 a.m. OK Python 3 TESTS 11 281 11673600
324506453 ppsaikiran1234 C June 15, 2025, 10:48 a.m. OK Python 3 TESTS 11 281 11673600

remove filters

Back to search problems