Hello 2024

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
1919 Hello 2024 FINISHED False 9000 71853923 Jan. 6, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1126 ) E Counting Prefixes PROGRAMMING combinatorics dp math 2600

There is a hidden array (a) of size (n) consisting of only (1) and (-1). Let (p) be the prefix sums of array (a). More formally, (p) is an array of length (n) defined as (p_i = a_1 + a_2 + \ldots + a_i). Afterwards, array (p) is sorted in non-decreasing order. For example, if (a = 1, -1, -1, 1, 1), then (p = 1, 0, -1, 0, 1) before sorting and (p = -1, 0, 0, 1, 1) after sorting. You are given the prefix sum array (p) after sorting, but you do not know what array (a) is. Your task is to count the number of initial arrays (a) such that the above process results in the given sorted prefix sum array (p). As this number can be large, you are only required to find it modulo (998\,244\,353). Each test contains multiple test cases. The first line contains a single integer (t) ((1 \leq t \leq 1000)) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \le n \le 5000)) — the size of the hidden array (a). The second line of each test case contains (n) integers (p_1, p_2, \ldots, p_n) ((|p_i| \le n)) — the (n) prefix sums of (a) sorted in non-decreasing order. It is guaranteed that (p_1 \le p_2 \le \ldots \le p_n). It is guaranteed that the sum of (n) over all test cases does not exceed (5000). For each test case, output the answer modulo (998\,244\,353). In the first two test cases, the only possible arrays (a) for (n = 1) are (a = 1) and (a = -1). Their respective sorted prefix sum arrays (p) are (p = 1) and (p = -1). Hence, there is no array (a) that can result in the sorted prefix sum array (p = 0) and there is exactly (1) array (a) that can result in the sorted prefix sum array (p = 1). In the third test case, it can be proven that there is no array (a) that could result in the sorted p

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
240617287 rainboy E Jan. 6, 2024, 8:39 p.m. OK GNU C11 TESTS 35 280 409600 2600
240600628 chro4896 E Jan. 6, 2024, 5:51 p.m. OK GNU C11 TESTS 35 639 512000 2600
240632753 Snow_Lyric E Jan. 7, 2024, 3:21 a.m. OK GNU C++14 TESTS 35 124 1024000 2600
240637193 paul2008 E Jan. 7, 2024, 4:42 a.m. OK GNU C++14 TESTS 35 124 100659200 2600
240636892 KellyWLJ E Jan. 7, 2024, 4:37 a.m. OK GNU C++14 TESTS 35 171 212275200 2600
240600791 -2x9_21- E Jan. 6, 2024, 5:51 p.m. OK GNU C++14 TESTS 35 280 204800 2600
240633168 LM_qwq E Jan. 7, 2024, 3:29 a.m. OK GNU C++14 TESTS 35 342 201011200 2600
240626976 RobertoFirmino E Jan. 7, 2024, 12:58 a.m. OK GNU C++14 TESTS 35 468 409600 2600
240594203 _CbrX_ E Jan. 6, 2024, 4:55 p.m. OK GNU C++17 TESTS 35 31 1331200 2600
240611831 Ant_Man E Jan. 6, 2024, 7:25 p.m. OK GNU C++17 TESTS 35 31 11571200 2600
240632869 1.618 E Jan. 7, 2024, 3:23 a.m. OK GNU C++17 TESTS 35 139 100659200 2600
240597705 Bucketsmith E Jan. 6, 2024, 5:04 p.m. OK GNU C++17 TESTS 35 171 102707200 2600
240602321 peti1234 E Jan. 6, 2024, 5:57 p.m. OK GNU C++17 TESTS 35 233 200908800 2600
240596442 izban E Jan. 6, 2024, 5:01 p.m. OK GNU C++17 TESTS 35 264 101273600 2600
240614592 KhaledBadr1 E Jan. 6, 2024, 8:01 p.m. OK GNU C++17 TESTS 35 280 102297600 2600
240643128 pengyantong E Jan. 7, 2024, 5:56 a.m. OK GNU C++17 TESTS 35 327 307200 2600
240643067 pengyantong E Jan. 7, 2024, 5:56 a.m. OK GNU C++17 TESTS 35 327 1638400 2600
240604277 liympanda E Jan. 6, 2024, 6:09 p.m. OK GNU C++17 TESTS 35 343 5120000 2600
240613665 Benq E Jan. 6, 2024, 7:48 p.m. OK GNU C++17 (64) TESTS 35 15 102400 2600
240630810 chappy1 E Jan. 7, 2024, 2:38 a.m. OK GNU C++17 (64) TESTS 35 15 102400 2600
240619282 eriksuenderhauf E Jan. 6, 2024, 9:14 p.m. OK GNU C++17 (64) TESTS 35 15 204800 2600
240595084 Rubikun E Jan. 6, 2024, 4:57 p.m. OK GNU C++17 (64) TESTS 35 15 204800 2600
240635072 enslaved E Jan. 7, 2024, 4:06 a.m. OK GNU C++17 (64) TESTS 35 31 102400 2600
240636460 woee E Jan. 7, 2024, 4:30 a.m. OK GNU C++17 (64) TESTS 35 31 204800 2600
240619109 eriksuenderhauf E Jan. 6, 2024, 9:11 p.m. OK GNU C++17 (64) TESTS 35 31 204800 2600
240596457 Xellos E Jan. 6, 2024, 5:01 p.m. OK GNU C++17 (64) TESTS 35 31 204800 2600
240594328 tiinpeng E Jan. 6, 2024, 4:55 p.m. OK GNU C++17 (64) TESTS 35 31 307200 2600
240603586 DRA E Jan. 6, 2024, 6:05 p.m. OK GNU C++17 (64) TESTS 35 93 100761600 2600
240594993 APJifengc2 E Jan. 6, 2024, 4:57 p.m. OK GNU C++20 (64) TESTS 35 15 102400 2600
240594217 cai_lw E Jan. 6, 2024, 4:55 p.m. OK GNU C++20 (64) TESTS 35 15 102400 2600
240594230 Ormlis E Jan. 6, 2024, 4:55 p.m. OK GNU C++20 (64) TESTS 35 15 204800 2600
240597740 amano_hina E Jan. 6, 2024, 5:04 p.m. OK GNU C++20 (64) TESTS 35 15 307200 2600
240606466 Monarchuwu E Jan. 6, 2024, 6:27 p.m. OK GNU C++20 (64) TESTS 35 15 716800 2600
240595898 wavelets E Jan. 6, 2024, 5 p.m. OK GNU C++20 (64) TESTS 35 15 1945600 2600
240627126 bobbilyking E Jan. 7, 2024, 1:03 a.m. OK GNU C++20 (64) TESTS 35 15 3072000 2600
240631377 culver0412 E Jan. 7, 2024, 2:52 a.m. OK GNU C++20 (64) TESTS 35 30 1228800 2600
240618388 MridulAhi E Jan. 6, 2024, 8:58 p.m. OK GNU C++20 (64) TESTS 35 31 204800 2600
240606123 Nakagawa.Kanon E Jan. 6, 2024, 6:24 p.m. OK GNU C++20 (64) TESTS 35 31 307200 2600
240596222 Dukkha E Jan. 6, 2024, 5 p.m. OK Java 21 TESTS 35 436 144588800 2600
240635730 golions E Jan. 7, 2024, 4:18 a.m. OK Java 8 TESTS 35 311 0 2600
240612761 huntercf E Jan. 6, 2024, 7:37 p.m. OK PyPy 3 TESTS 35 374 10035200 2600
240595797 dyppp E Jan. 6, 2024, 4:59 p.m. OK PyPy 3-64 TESTS 35 249 10240000 2600

remove filters

Back to search problems