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. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 749 ) | D | Attraction Theory | PROGRAMMING | combinatorics dp implementation math |
There are (n) people in positions (p_1, p_2, \ldots, p_n) on a one-dimensional coordinate axis. Initially, (p_i = i) for each (1 \leq i \leq n). You can introduce an attraction at some integer coordinate (x) ((1 \le x \le n)), and then all the people will move closer to the attraction to look at it. Formally, if you put an attraction in position (x) ((1 \le x \le n)), the following changes happen for each person (i) ((1 \le i \le n)): if (p_i = x), no change; if (p_i < x), the person moves in the positive direction, and (p_i) is incremented by (1); if (p_i > x), the person moves in the negative direction, and (p_i) is decremented by (1). You can put attractions any finite number of times, and in any order you want. It can be proven that all positions of a person always stays within the range (1, n), i.e. (1 \le p_i \le n) at all times. Each position (x) ((1 \le x \le n)), has a value (a_x) associated with it. The score of a position array (p_1, p_2, \ldots, p_n), denoted by (score(p)), is (\sum_{i = 1}^{n} a_{p_i}), i.e. your score increases by (a_x) for every person standing at (x) in the end. Over all possible distinct position arrays (p) that are possible with placing attractions, find the sum of (score(p)). Since the answer may be large, print 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) ((1 \le n \le 2 \cdot 10^5)). The second line of each test case contains (n) integers — (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 10^9)) 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 sum of (score(p)) |
| Editorial of Codeforces Round 1053 (Div. 1, Div. 2) |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 340197924 | KumaTachiRen | D | Sept. 24, 2025, 1:52 p.m. | OK | C# 13 | TESTS | 18 | 202 | 6656000 | ||
| 340288357 | NanguX | D | Sept. 25, 2025, 4:59 a.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 140 | 4812800 | ||
| 340282782 | 8Conan8 | D | Sept. 25, 2025, 3:50 a.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 155 | 3276800 | ||
| 340221418 | Az3ar | D | Sept. 24, 2025, 4:18 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 155 | 3379200 | ||
| 340284214 | 8Conan8 | D | Sept. 25, 2025, 4:07 a.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 171 | 3276800 | ||
| 340195214 | NKheyuxiang | D | Sept. 24, 2025, 1:42 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 171 | 3993600 | ||
| 340191344 | Miracle_Creater | D | Sept. 24, 2025, 1:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 171 | 5632000 | ||
| 340196056 | JaeminPark | D | Sept. 24, 2025, 1:45 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 171 | 6451200 | ||
| 340183808 | mickeyjung | D | Sept. 24, 2025, 1:03 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 171 | 7577600 | ||
| 340186775 | wutongchun | D | Sept. 24, 2025, 1:13 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 171 | 10444800 | ||
| 340202163 | leukocyte | D | Sept. 24, 2025, 2:09 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 186 | 3276800 | ||
| 340277617 | Caylex | D | Sept. 25, 2025, 2:39 a.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 93 | 4096000 | ||
| 340267811 | Noobish_Monk | D | Sept. 25, 2025, 12:12 a.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 93 | 7270400 | ||
| 340186319 | 244mhq | D | Sept. 24, 2025, 1:11 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 109 | 5836800 | ||
| 340185392 | cn449 | D | Sept. 24, 2025, 1:08 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 109 | 7987200 | ||
| 340296350 | candy0014 | D | Sept. 25, 2025, 6:04 a.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 109 | 8089600 | ||
| 340280155 | lldxjw | D | Sept. 25, 2025, 3:19 a.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 109 | 12902400 | ||
| 340200329 | HugeWide | D | Sept. 24, 2025, 2:01 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 109 | 16076800 | ||
| 340224545 | John_zyj | D | Sept. 24, 2025, 4:42 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 124 | 1638400 | ||
| 340180336 | hitonanode | D | Sept. 24, 2025, 12:52 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 124 | 3891200 | ||
| 340179408 | anmichi | D | Sept. 24, 2025, 12:49 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 124 | 4198400 | ||
| 340274759 | fydj | D | Sept. 25, 2025, 1:55 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 62 | 8601600 | ||
| 340270629 | deltarune | D | Sept. 25, 2025, 1:04 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 78 | 9625600 | ||
| 340222916 | exgcd | D | Sept. 24, 2025, 4:30 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 93 | 2048000 | ||
| 340193129 | PinkieRabbit | D | Sept. 24, 2025, 1:35 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 93 | 3993600 | ||
| 340167536 | ecnerwala | D | Sept. 24, 2025, 12:16 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 93 | 3993600 | ||
| 340274656 | rgnerdplayer | D | Sept. 25, 2025, 1:54 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 93 | 4300800 | ||
| 340283982 | fishcathu | D | Sept. 25, 2025, 4:04 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 93 | 4812800 | ||
| 340279341 | autumoon | D | Sept. 25, 2025, 3:09 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 93 | 8089600 | ||
| 340264811 | OpGm | D | Sept. 24, 2025, 11 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 108 | 5939200 | ||
| 340221805 | nifeshe | D | Sept. 24, 2025, 4:21 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 124 | 9113600 | ||
| 340173639 | arvindf232 | D | Sept. 24, 2025, 12:33 p.m. | OK | Kotlin 2.2 | TESTS | 18 | 718 | 307200 | ||
| 340244287 | golomb | D | Sept. 24, 2025, 6:27 p.m. | OK | PyPy 3-64 | TESTS | 18 | 514 | 26726400 | ||
| 340176062 | bribritt | D | Sept. 24, 2025, 12:39 p.m. | OK | PyPy 3-64 | TESTS | 18 | 577 | 36659200 | ||
| 340212928 | sansen | D | Sept. 24, 2025, 2:49 p.m. | OK | Rust 2021 | TESTS | 18 | 1656 | 22937600 |
Back to search problems