EPIC Institute of Technology Round Summer 2025 (Codeforces Round 1036, 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
2124 EPIC Institute of Technology Round Summer 2025 (Codeforces Round 1036, Div. 1 + Div. 2) FINISHED False 10800 24593123 July 6, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 563 ) F2 Appending Permutations (Hard Version) PROGRAMMING combinatorics dp

This is the hard version of the problem. The difference between the versions is that in this version, (n \leq 5000). You can hack only if you solved all versions of this problem. You are given an initially empty array (a). You may perform the following operation any number of times: Choose an integer (s \ge 1) and append a cyclic shift of the array (1, 2, \ldots, s) to the end of (a). Formally, select integers (s) and (r) such that (1 \le r \le s), and append the array () r, r+1, \ldots, s, 1, 2, \ldots, r-1 () to the end of (a). () r, r+1, \ldots, s, 1, 2, \ldots, r-1 () to the end of (a). Your task is to count the number of distinct arrays of length exactly (n) that can be constructed using the allowed operation and satisfy all of the given restrictions. Two arrays are considered different if they differ at any position from (1) to (n). Print the answer modulo (998\,244\,353). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 5000)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((1 \leq n \leq 5000, 0 \leq m \leq \min(5000, n^2))) — the length of the array (a) and the number of restrictions. The following (m) lines each contain two integers (i) and (x) ((1 \leq i,x \leq n)), indicating that (a_i\neq x) is a requirement of the final array. It is guaranteed that no limitation is given more than once. It is guaranteed that the sum of (n) over all test cases does not exceed (5000), and the sum of (m) over all test cases does not exceed (5000). For each test case, output the number of arrays modulo (998\,244\,353). In the first test case, there are (7) total attainable arrays: (1,2,3, 2,3,1, 3,1,2, 1,1,2, 1,2,1, 2,1,1, 1,1,1). In the second test case, none of the above (7) a

Tutorials

EPIC Institute of Technology Round Summer 2025 (Codeforces Round 1036, 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
327876437 surajbhan99 F2 July 7, 2025, 5:55 a.m. OK C++17 (GCC 7-32) TESTS 30 593 301056000
327864091 jagsxi F2 July 7, 2025, 3:58 a.m. OK C++17 (GCC 7-32) TESTS 30 624 323993600
327817539 grass8sheep F2 July 6, 2025, 5:07 p.m. OK C++17 (GCC 7-32) TESTS 30 827 327065600
327841955 Az3ar F2 July 6, 2025, 8:56 p.m. OK C++17 (GCC 7-32) TESTS 30 1062 301875200
327875850 slzxpanhongxuan F2 July 7, 2025, 5:49 a.m. OK C++17 (GCC 7-32) TESTS 30 1280 226611200
327874924 phxqwq F2 July 7, 2025, 5:39 a.m. OK C++17 (GCC 7-32) TESTS 30 1280 226611200
327823407 opia F2 July 6, 2025, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 30 1437 175820800
327818727 Sai_t F2 July 6, 2025, 5:11 p.m. OK C++17 (GCC 7-32) TESTS 30 1937 251289600
327850623 SpinSpen F2 July 7, 2025, 12:30 a.m. OK C++17 (GCC 7-32) TESTS 30 2014 297779200
327832295 Teja-Smart F2 July 6, 2025, 7:01 p.m. OK C++17 (GCC 7-32) TESTS 30 2015 628838400
327832316 EJIC_B_KEDAX F2 July 6, 2025, 7:02 p.m. OK C++20 (GCC 13-64) TESTS 30 515 306790400
327833834 anmichi F2 July 6, 2025, 7:14 p.m. OK C++20 (GCC 13-64) TESTS 30 562 201011200
327856623 Leo_W F2 July 7, 2025, 2:25 a.m. OK C++20 (GCC 13-64) TESTS 30 608 403558400
327846981 thisislike_fan F2 July 6, 2025, 10:44 p.m. OK C++20 (GCC 13-64) TESTS 30 624 247808000
327823808 jeroenodb F2 July 6, 2025, 5:29 p.m. OK C++20 (GCC 13-64) TESTS 30 656 322764800
327863743 lmh_qwq F2 July 7, 2025, 3:54 a.m. OK C++20 (GCC 13-64) TESTS 30 687 326656000
327824511 -0v0- F2 July 6, 2025, 5:31 p.m. OK C++20 (GCC 13-64) TESTS 30 702 402329600
327822731 Hamed_Ghaffari F2 July 6, 2025, 5:25 p.m. OK C++20 (GCC 13-64) TESTS 30 703 480460800
327813583 Kude F2 July 6, 2025, 4:53 p.m. OK C++20 (GCC 13-64) TESTS 30 765 326963200
327840727 arbuzick F2 July 6, 2025, 8:36 p.m. OK C++20 (GCC 13-64) TESTS 30 796 197734400
327843528 maro_7atem365 F2 July 6, 2025, 9:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 374 197324800
327810711 furry F2 July 6, 2025, 4:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 624 229068800
327815623 superguymj F2 July 6, 2025, 5 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 624 297676800
327812649 conqueror_of_tourist F2 July 6, 2025, 4:50 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 625 197836800
327835008 MAKMED1337 F2 July 6, 2025, 7:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 671 147456000
327816968 Be_dos F2 July 6, 2025, 5:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 718 424755200
327863490 jhdonghj112 F2 July 7, 2025, 3:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 734 398336000
327823356 exgcd F2 July 6, 2025, 5:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 750 306688000
327831738 Akulyat F2 July 6, 2025, 6:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 827 427622400
327874936 nifeshe F2 July 7, 2025, 5:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 843 398336000
327847285 rainboy F2 July 6, 2025, 10:54 p.m. OK GNU C11 TESTS 30 733 225587200
327856353 smilences F2 July 7, 2025, 2:21 a.m. OK PyPy 3-64 TESTS 30 1296 404889600

remove filters

Back to search problems