Codeforces Round 1067 (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
2158 Codeforces Round 1067 (Div. 2) FINISHED False 7200 11978723 Nov. 29, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 612 ) E Sink PROGRAMMING data structures dsu dsu graphs graphs

You are given a grid containing (n) rows and (m) columns. Every cell ((i, j)), located in the (i)-th row and (j)-th column, has a positive integer value associated with it (a_{i, j}). Two cells are adjacent if and only if they share a common side in the grid. You are allowed to construct holes at cells of your choice. A cell ((x, y)) is a sink if and only if it has a hole, or is adjacent to a sink ((i, j)) with (a_{x, y} \ge a_{i, j}). The beauty of a grid is defined as the minimum number of holes you need to construct so that every cell becomes a sink. You have to determine the beauty of this grid. You are also given (q) queries. In a query, you are given three positive integers (r), (c), and (x). The current value of cell ((r, c)) is decreased by (x). After each query, determine the beauty of the grid considering no holes have been constructed yet. Note that queries are cumulative, so the effects of each query carry on to future queries. It is guaranteed that after every query the value of each cell will remain positive. 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 two integers (n) and (m) ((1 \le n, m \le 2 \cdot 10^5), (1 \le n \cdot m \le 2 \cdot 10^5)) — the number of rows and columns, respectively. The following (n) lines contain (m) integers each; the (j)-th element in the (i)-th line (a_{i, j}) is the number written in the (j)-th cell of the (i)-th row ((1 \le a_{i,j} \le 10^9)). The next line contains a single integer (q) ((0 \le q \le 2\cdot 10^5)) — the number of queries. The following (q) lines contain (3) integers each — (r, c,) and (x) ((1\le r \le n, 1\le c \le m, 1\le x < 10^9)). It is guaranteed that the sum of (n \cdot m) and the sum of $$$

Tutorials

Codeforces Round 1067 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
351229140 walizamanee E Nov. 29, 2025, 3:56 p.m. OK C++17 (GCC 7-32) TESTS 30 358 9216000
351280331 Eason_He E Nov. 30, 2025, 1:42 a.m. OK C++17 (GCC 7-32) TESTS 30 389 26828800
351247030 JakobZ E Nov. 29, 2025, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 30 406 12492800
351232114 Linx E Nov. 29, 2025, 4:04 p.m. OK C++17 (GCC 7-32) TESTS 30 406 14745600
351243517 harshh9 E Nov. 29, 2025, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 30 421 3379200
351265530 AlmoezAli E Nov. 29, 2025, 7:52 p.m. OK C++17 (GCC 7-32) TESTS 30 499 12390400
351250908 kdisback E Nov. 29, 2025, 5:35 p.m. OK C++17 (GCC 7-32) TESTS 30 624 5427200
351238572 sharan_eshwar E Nov. 29, 2025, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 30 921 21299200
351259215 Sersawy E Nov. 29, 2025, 6:42 p.m. OK C++17 (GCC 7-32) TESTS 30 952 16076800
351233486 AMRY E Nov. 29, 2025, 4:07 p.m. OK C++17 (GCC 7-32) TESTS 30 1108 216678400
351280756 thisislike_fan E Nov. 30, 2025, 1:55 a.m. OK C++20 (GCC 13-64) TESTS 30 202 20889600
351247537 Noogler_from_Google E Nov. 29, 2025, 5:11 p.m. OK C++20 (GCC 13-64) TESTS 30 249 3891200
351241011 _odium E Nov. 29, 2025, 4:28 p.m. OK C++20 (GCC 13-64) TESTS 30 265 9011200
351280069 horizon2 E Nov. 30, 2025, 1:33 a.m. OK C++20 (GCC 13-64) TESTS 30 311 20889600
351237451 Zylenox E Nov. 29, 2025, 4:18 p.m. OK C++20 (GCC 13-64) TESTS 30 327 21606400
351231271 icecuber E Nov. 29, 2025, 4:01 p.m. OK C++20 (GCC 13-64) TESTS 30 327 25497600
351272395 kondasujay2 E Nov. 29, 2025, 9:34 p.m. OK C++20 (GCC 13-64) TESTS 30 327 38604800
351240112 CatsAreCool E Nov. 29, 2025, 4:25 p.m. OK C++20 (GCC 13-64) TESTS 30 343 19456000
351279065 minchan_bae E Nov. 30, 2025, 12:57 a.m. OK C++20 (GCC 13-64) TESTS 30 421 27852800
351230617 BurnedChicken E Nov. 29, 2025, 4 p.m. OK C++20 (GCC 13-64) TESTS 30 437 51712000
351239124 realclueless E Nov. 29, 2025, 4:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 234 2560000
351232238 dmkozyrev E Nov. 29, 2025, 4:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 265 18432000
351236637 kolorvxl E Nov. 29, 2025, 4:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 265 19456000
351275948 n685 E Nov. 29, 2025, 10:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 280 14643200
351276792 Soultaker E Nov. 29, 2025, 11:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 280 38092800
351248512 awooba E Nov. 29, 2025, 5:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 296 11264000
351259483 ShirayukiNoa E Nov. 29, 2025, 6:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 296 14233600
351262316 catgirl E Nov. 29, 2025, 7:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 311 25395200
351281986 svcf E Nov. 30, 2025, 2:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 327 15052800
351228627 ne0r0yal E Nov. 29, 2025, 3:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 327 18022400
351241048 KING_CODER_ANI E Nov. 29, 2025, 4:28 p.m. OK Java 21 TESTS 30 484 3174400
351232540 SumitXorY E Nov. 29, 2025, 4:05 p.m. OK Java 21 TESTS 30 499 921600
351254119 AnimeshT1008 E Nov. 29, 2025, 6 p.m. OK Java 21 TESTS 30 499 3379200
351271837 sad_truant E Nov. 29, 2025, 9:22 p.m. OK Java 21 TESTS 30 905 50688000
351238536 Your_Hated_CP_GUY E Nov. 29, 2025, 4:21 p.m. OK PyPy 3-64 TESTS 30 1155 91750400

remove filters

Back to search problems