Atto Round 1 (Codeforces Round 1041, Div. 1 + 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
2127 Atto Round 1 (Codeforces Round 1041, Div. 1 + Div. 2) FINISHED False 10800 21828323 Aug. 7, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1051 ) F Hamed and AghaBalaSar PROGRAMMING combinatorics math

Hamid wrote (3014) lines of code for the a+b problem and gave (10) lines of it to Hamed; then the following problem came to Hamed's mind. You are given two integers (n) and (m). An array (a_1,a_2,\ldots,a_n) is called snake if and only if all of the following conditions hold: All elements in (a) are integers between (0) and (m); (a_1 + a_2 + \cdots + a_n = m); (a_n=\max\left(a_1, a_2, \ldots, a_n\right)). We define (f(a)) as in the following pseudocode: Find the sum of (f(a)) over all snake arrays (a_1,a_2,\ldots,a_n), modulo (10^9+7). 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) ((2 \leq n \leq 2 \cdot 10^5), (0 \leq m \leq 2 \cdot 10^5)) — the length of a snake array and the sum of all elements in a snake array. It is guaranteed that the sum of (m) over all test cases does not exceed (2 \cdot 10^5). For each test case, output a single integer — the sum of (f(a)) over all snake arrays (a_1,a_2,\ldots,a_n), modulo (10^9+7). In the first test case, there are three snake arrays: (f(0, 5) = 5); (f(1, 4) = 3); (f(2, 3) = 1). Thus, the answer is (5+3+1=9). In the second test case, there are six snake arrays: (f(0, 0, 4) = 4); (f(0, 1, 3) = 3); (f(1, 0, 3) = 2); (f(1, 1, 2) = 1); (f(0, 2, 2) = 2); (f(2, 0, 2) = 2). Thus, the answer is (4+3+2+1+2+2=14). In the fifth test case, a possible snake array is: (f(3, 1, 4, 1, 5, 9) = 6).

Tutorials

Atto Round 1 (Codeforces Round 1041, Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
332924521 CompileError404 F Aug. 7, 2025, 8:15 p.m. OK C++17 (GCC 7-32) TESTS 35 342 3276800
332953241 fy_23forever F Aug. 8, 2025, 4:48 a.m. OK C++17 (GCC 7-32) TESTS 35 343 2662400
332903990 KaguyaH F Aug. 7, 2025, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 35 358 1228800
332950786 Max_s_xaM F Aug. 8, 2025, 4:17 a.m. OK C++17 (GCC 7-32) TESTS 35 389 11776000
332926887 TychoElling F Aug. 7, 2025, 8:50 p.m. OK C++17 (GCC 7-32) TESTS 35 406 2764800
332948629 lalaouye F Aug. 8, 2025, 3:50 a.m. OK C++17 (GCC 7-32) TESTS 35 421 6451200
332899625 waaadreamer F Aug. 7, 2025, 5:17 p.m. OK C++17 (GCC 7-32) TESTS 35 421 6451200
332958670 nhonyc F Aug. 8, 2025, 5:50 a.m. OK C++17 (GCC 7-32) TESTS 35 436 8089600
332940405 asoulcoming F Aug. 8, 2025, 2:03 a.m. OK C++17 (GCC 7-32) TESTS 35 437 6451200
332951459 lucnguyen030608 F Aug. 8, 2025, 4:26 a.m. OK C++17 (GCC 7-32) TESTS 35 452 6451200
332947254 Tobo F Aug. 8, 2025, 3:33 a.m. OK C++20 (GCC 13-64) TESTS 35 108 3276800
332934291 InBayesWeTrust F Aug. 8, 2025, 12:11 a.m. OK C++20 (GCC 13-64) TESTS 35 124 2764800
332916986 Xellos F Aug. 7, 2025, 6:56 p.m. OK C++20 (GCC 13-64) TESTS 35 124 2764800
332903993 noya2 F Aug. 7, 2025, 5:28 p.m. OK C++20 (GCC 13-64) TESTS 35 124 8396800
332952018 Shantanu_Bairagi F Aug. 8, 2025, 4:33 a.m. OK C++20 (GCC 13-64) TESTS 35 139 9728000
332897568 Sanae F Aug. 7, 2025, 5:12 p.m. OK C++20 (GCC 13-64) TESTS 35 139 9728000
332921771 hkoasis8 F Aug. 7, 2025, 7:42 p.m. OK C++20 (GCC 13-64) TESTS 35 140 2764800
332907293 afuafu F Aug. 7, 2025, 5:34 p.m. OK C++20 (GCC 13-64) TESTS 35 140 16076800
332952742 trashaccountasf F Aug. 8, 2025, 4:42 a.m. OK C++20 (GCC 13-64) TESTS 35 155 6451200
332949572 nhan0510 F Aug. 8, 2025, 4:01 a.m. OK C++20 (GCC 13-64) TESTS 35 155 6451200
332932543 Visual_Studio F Aug. 7, 2025, 11:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 93 2867200
332904219 koukanni F Aug. 7, 2025, 5:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 108 3276800
332956157 1G1U4E5S1T4 F Aug. 8, 2025, 5:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 108 4812800
332899818 Sirantic F Aug. 7, 2025, 5:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 109 3276800
332934679 deltarune F Aug. 8, 2025, 12:19 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 109 9728000
332953664 ApurbaKumarShow F Aug. 8, 2025, 4:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 124 2867200
332953565 ttamx F Aug. 8, 2025, 4:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 124 3686400
332952267 dasrupam23 F Aug. 8, 2025, 4:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 124 6451200
332928918 Qwerty1412 F Aug. 7, 2025, 9:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 124 6451200
332924121 gu51yo F Aug. 7, 2025, 8:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 124 6451200
332921025 rainboy F Aug. 7, 2025, 7:34 p.m. OK GNU C11 TESTS 35 311 4915200
332922464 Dominion948 F Aug. 7, 2025, 7:50 p.m. OK Go TESTS 35 124 10649600
332945271 smilences F Aug. 8, 2025, 3:06 a.m. OK PyPy 3-64 TESTS 35 296 12083200
332958636 yejordan8888 F Aug. 8, 2025, 5:50 a.m. OK PyPy 3-64 TESTS 35 327 13107200
332904617 conqueror_of_tourist F Aug. 7, 2025, 5:30 p.m. OK PyPy 3-64 TESTS 35 578 29184000
332901187 iska_terminator F Aug. 7, 2025, 5:21 p.m. OK PyPy 3-64 TESTS 35 671 12595200
332924500 teekaytai F Aug. 7, 2025, 8:14 p.m. OK PyPy 3-64 TESTS 35 1358 36249600
332924366 teekaytai F Aug. 7, 2025, 8:13 p.m. OK PyPy 3-64 TESTS 35 1499 80076800

remove filters

Back to search problems