Codeforces Round 1053 (Div. 1)

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
2150 Codeforces Round 1053 (Div. 1) FINISHED False 11700 17691923 Sept. 24, 2025, 11:35 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 6002 ) B Grid Counting PROGRAMMING combinatorics math

Alice has a grid of size (n \times n). Initially, all cells are colored white. Alice wants to color some cells black satisfying certain properties. Let ((x_1, y_1), (x_2, y_2), \ldots, (x_m, y_m)) be the cells colored black. You are given an array (a) of size (n). The following conditions must be satisfied: For each row (k) ((1 \le k \le n)), there exists exactly (a_k) indices (i) ((1 \le i \le m)) such that (x_i = k). Less formally, there should be (a_k) black cells in row (k). For each (k) ((1 \le k \le n)), there exists exactly one index (i) such that (\max(x_i, y_i) = k). For each (k) ((1 \le k \le n)), there exists exactly one index (i) such that (\max(x_i, n + 1 - y_i) = k). For example, when (a = 2, 2, 1, 0, 0), a possible set of black cells is (\{(1, 1), (2, 2), (3, 3), (2, 4), (1, 5)\}). This corresponds to the following grid: Count the number of possible grids. (2) grids are said to be different if there is some cell which is colored black in one of the grids, and white in the other. Since the answer may be large, output it modulo (998\,244\,353). 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 2 \cdot 10^5)). The second line of each test case contains (n) integers — (a_1, a_2, \ldots, a_n) ((0 \le a_i \le n)) It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output a single line containing an integer: the number of valid grids modulo (998\,244\,353). In the first test case, the only valid grid is the one in the statement. In the second test case, the only valid grid is described by the set of black cells (\{(1, 1), (1, 2)\}). In the third test case, there are no va

Tutorials

Editorial of Codeforces Round 1053 (Div. 1, Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
340157835 KumaTachiRen B Sept. 24, 2025, 11:53 a.m. OK C# 13 TESTS 21 156 3276800
340159423 8Conan8 B Sept. 24, 2025, 11:57 a.m. OK C++17 (GCC 7-32) TESTS 21 78 2457600
340157610 potato167 B Sept. 24, 2025, 11:53 a.m. OK C++17 (GCC 7-32) TESTS 21 93 102400
340187605 Pumkinhead_Me B Sept. 24, 2025, 1:15 p.m. OK C++17 (GCC 7-32) TESTS 21 93 921600
340161652 fengqiyuka B Sept. 24, 2025, 12:02 p.m. OK C++17 (GCC 7-32) TESTS 21 93 2560000
340182837 Anshuman_15 B Sept. 24, 2025, 1 p.m. OK C++17 (GCC 7-32) TESTS 21 93 3174400
340270993 num6 B Sept. 25, 2025, 1:08 a.m. OK C++17 (GCC 7-32) TESTS 21 93 3276800
340157368 mickeyjung B Sept. 24, 2025, 11:52 a.m. OK C++17 (GCC 7-32) TESTS 21 93 3276800
340165207 LaDeX B Sept. 24, 2025, 12:10 p.m. OK C++17 (GCC 7-32) TESTS 21 93 4096000
340289065 Watersphere B Sept. 25, 2025, 5:07 a.m. OK C++17 (GCC 7-32) TESTS 21 93 4812800
340268586 ccqyx123 B Sept. 25, 2025, 12:28 a.m. OK C++17 (GCC 7-32) TESTS 21 93 4812800
340164901 www_bilibili_com B Sept. 24, 2025, 12:09 p.m. OK C++20 (GCC 13-64) TESTS 21 62 4198400
340167267 beiyuli B Sept. 24, 2025, 12:15 p.m. OK C++20 (GCC 13-64) TESTS 21 77 0
340271348 UBory B Sept. 25, 2025, 1:12 a.m. OK C++20 (GCC 13-64) TESTS 21 77 921600
340173863 dingdong B Sept. 24, 2025, 12:33 p.m. OK C++20 (GCC 13-64) TESTS 21 77 921600
340289625 Ecank B Sept. 25, 2025, 5:13 a.m. OK C++20 (GCC 13-64) TESTS 21 77 1024000
340187104 -.--..-..... B Sept. 24, 2025, 1:14 p.m. OK C++20 (GCC 13-64) TESTS 21 77 1331200
340282641 h354222857 B Sept. 25, 2025, 3:49 a.m. OK C++20 (GCC 13-64) TESTS 21 77 1638400
340256288 Noobish_Monk B Sept. 24, 2025, 8:09 p.m. OK C++20 (GCC 13-64) TESTS 21 77 1638400
340152675 _istil B Sept. 24, 2025, 11:45 a.m. OK C++20 (GCC 13-64) TESTS 21 77 1638400
340267170 HCCoder B Sept. 25, 2025, midnight OK C++20 (GCC 13-64) TESTS 21 77 1740800
340202120 IkunTeddy B Sept. 24, 2025, 2:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 61 4403200
340294827 UniGravity B Sept. 25, 2025, 5:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 62 2457600
340157286 maspy B Sept. 24, 2025, 11:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 62 3584000
340168692 fydj B Sept. 24, 2025, 12:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 62 5324800
340186999 volcano_2025 B Sept. 24, 2025, 1:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 77 0
340163107 Erico_chou B Sept. 24, 2025, 12:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 77 204800
340170152 weirdflexbutok B Sept. 24, 2025, 12:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 77 512000
340164625 xcx2010 B Sept. 24, 2025, 12:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 77 1433600
340224675 MahmoudBassem B Sept. 24, 2025, 4:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 77 1638400
340282194 w050423 B Sept. 25, 2025, 3:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 77 2457600
340149377 hos.lyric B Sept. 24, 2025, 11:40 a.m. OK D TESTS 21 140 11878400
340207817 nathanballman B Sept. 24, 2025, 2:33 p.m. OK Java 21 TESTS 21 671 4096000
340217859 ccj123 B Sept. 24, 2025, 3:50 p.m. OK Java 21 TESTS 21 764 2355200
340167143 alexey.enkov B Sept. 24, 2025, 12:15 p.m. OK Kotlin 1.9 TESTS 21 781 22732800
340153248 arvindf232 B Sept. 24, 2025, 11:46 a.m. OK Kotlin 2.2 TESTS 21 203 0
340163749 toam B Sept. 24, 2025, 12:07 p.m. OK PyPy 3-64 TESTS 21 156 30003200
340163019 Ayis137 B Sept. 24, 2025, 12:05 p.m. OK PyPy 3-64 TESTS 21 171 27852800
340278641 ibraheemkureshi B Sept. 25, 2025, 2:57 a.m. OK PyPy 3-64 TESTS 21 171 29900800
340161407 meow_love B Sept. 24, 2025, 12:01 p.m. OK PyPy 3-64 TESTS 21 171 30208000
340157415 alexwice B Sept. 24, 2025, 11:53 a.m. OK PyPy 3-64 TESTS 21 186 29593600
340178368 smilences B Sept. 24, 2025, 12:46 p.m. OK PyPy 3-64 TESTS 21 186 29798400
340162959 Alex239 B Sept. 24, 2025, 12:05 p.m. OK PyPy 3-64 TESTS 21 187 24576000
340175612 DarkTemplarDrop B Sept. 24, 2025, 12:38 p.m. OK PyPy 3-64 TESTS 21 202 28672000
340179461 dyppp B Sept. 24, 2025, 12:49 p.m. OK PyPy 3-64 TESTS 21 203 29696000
340161483 harurun4635 B Sept. 24, 2025, 12:01 p.m. OK PyPy 3-64 TESTS 21 218 19046400
340157477 OpGm B Sept. 24, 2025, 11:53 a.m. OK Python 3 TESTS 21 312 37478400
340164137 sansen B Sept. 24, 2025, 12:07 p.m. OK Rust 2021 TESTS 21 77 1126400
340154254 Egor B Sept. 24, 2025, 11:47 a.m. OK Rust 2024 TESTS 21 92 4710400
340162356 InO4 B Sept. 24, 2025, 12:03 p.m. OK Rust 2024 TESTS 21 140 4915200

remove filters

Back to search problems