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 |
|---|---|---|---|---|---|---|
| 2189 | Codeforces Round 1075 (Div. 2) | FINISHED | False | 7200 | 7226723 | Jan. 23, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 3895 ) | D1 | Little String (Easy Version) | PROGRAMMING | combinatorics dp math |
This is the easy version of the problem. The difference between the versions is that in this version, it is guaranteed that the string (s) does not contain the character ? . For the string (w_1w_2 \ldots w_n), consisting of characters 0 and 1 , we define (f(w)) as the number of permutations (p_1, p_2, \ldots, p_n) of the array (0, 1, \ldots, n-1), such that for all (i) from (1) to (n) the following holds: if (w_i = 1), then there exist such (1 \leq l \leq r \leq n) that (\operatorname{mex}(p_l, p_{l+1}, \ldots, p_r) = i);(^{\text{∗}}) if (w_i = 0), then there do not exist such (1 \leq l \leq r \leq n) that (\operatorname{mex}(p_l, p_{l+1}, \ldots, p_r) = i). Given a string (s_1s_2 \ldots s_n), consisting of characters 0 and 1 , and a positive integer (c). Note that in this version of the problem, the string (s) doesn't contain ? . Consider all strings (w) that can be obtained from (s) by replacing all characters ? with characters 0 and 1 . Find the smallest value of (f(w)) among all such strings (w) that is not divisible by (c), or determine that such a string (w) does not exist. Since the answer may be large, find it modulo (10^9+7). (^{\text{∗}})The minimum excluded (MEX) of a collection of integers (c_1, c_2, \ldots, c_k) is defined as the smallest non-negative integer (x) which does not occur in the collection (c). 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 (c) ((3 \leq n \leq 2 \cdot 10^5), (1 \leq c \leq 10^9)) — the length of the string and the number that limits the value of the function. The second line of each test case contains a string of length (n), consisting of characters 0 and 1 — the string (s). |
| Codeforces Round 1075 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 359439573 | ok12 | D1 | Jan. 23, 2026, 4:24 p.m. | OK | C# 13 | TESTS | 21 | 78 | 3174400 | ||
| 359444673 | _Equinox | D1 | Jan. 23, 2026, 4:32 p.m. | OK | C# 13 | TESTS | 21 | 109 | 2252800 | ||
| 359458359 | saltyy | D1 | Jan. 23, 2026, 6:04 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 31 | 0 | ||
| 359449245 | sidharthvalsan | D1 | Jan. 23, 2026, 5:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 31 | 102400 | ||
| 359442276 | lunarlity | D1 | Jan. 23, 2026, 4:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 31 | 102400 | ||
| 359463177 | Namine | D1 | Jan. 23, 2026, 6:40 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
| 359450847 | Bona_Boss | D1 | Jan. 23, 2026, 5:14 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
| 359444762 | alpha1215 | D1 | Jan. 23, 2026, 4:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
| 359444022 | WhiteGoose | D1 | Jan. 23, 2026, 4:31 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
| 359443966 | Yarik0urWorld | D1 | Jan. 23, 2026, 4:31 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
| 359440832 | shy_paper | D1 | Jan. 23, 2026, 4:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
| 359440721 | bingo | D1 | Jan. 23, 2026, 4:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
| 359495036 | Westxrn | D1 | Jan. 24, 2026, 4:42 a.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 31 | 0 | ||
| 359485025 | arinz | D1 | Jan. 24, 2026, 1:31 a.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 31 | 0 | ||
| 359457400 | VEDxyz7 | D1 | Jan. 23, 2026, 5:57 p.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 31 | 0 | ||
| 359451114 | wildhonestfur | D1 | Jan. 23, 2026, 5:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 31 | 0 | ||
| 359490679 | Shakuu | D1 | Jan. 24, 2026, 3:32 a.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 31 | 102400 | ||
| 359471025 | Khalid_Kamal_ | D1 | Jan. 23, 2026, 8:02 p.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 31 | 102400 | ||
| 359443550 | mady9613 | D1 | Jan. 23, 2026, 4:30 p.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 31 | 102400 | ||
| 359443322 | thomasyu | D1 | Jan. 23, 2026, 4:30 p.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 31 | 102400 | ||
| 359439949 | ahmetlbktd4 | D1 | Jan. 23, 2026, 4:24 p.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 31 | 102400 | ||
| 359501143 | whatever420 | D1 | Jan. 24, 2026, 5:38 a.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 46 | 0 | ||
| 359486881 | Kuro_neko | D1 | Jan. 24, 2026, 2:20 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 0 | ||
| 359483611 | RedSalt | D1 | Jan. 24, 2026, 12:49 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 0 | ||
| 359473545 | El_Qorsan | D1 | Jan. 23, 2026, 8:35 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 0 | ||
| 359471323 | Hanoon | D1 | Jan. 23, 2026, 8:06 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 0 | ||
| 359450503 | wasif2397 | D1 | Jan. 23, 2026, 5:12 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 0 | ||
| 359449299 | InvMod | D1 | Jan. 23, 2026, 5:06 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 0 | ||
| 359501908 | DivijJ | D1 | Jan. 24, 2026, 5:43 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 102400 | ||
| 359501579 | WilliamFung | D1 | Jan. 24, 2026, 5:41 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 102400 | ||
| 359489074 | shihen | D1 | Jan. 24, 2026, 3:01 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 102400 | ||
| 359486240 | Tanjiro_Kamado_069 | D1 | Jan. 24, 2026, 2:04 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 21 | 31 | 102400 | ||
| 359443768 | rainboy | D1 | Jan. 23, 2026, 4:31 p.m. | OK | GNU C11 | TESTS | 21 | 62 | 307200 | ||
| 359469240 | suryatejauppala | D1 | Jan. 23, 2026, 7:41 p.m. | OK | GNU C11 | TESTS | 21 | 78 | 204800 | ||
| 359465464 | keshav_.agg | D1 | Jan. 23, 2026, 7:01 p.m. | OK | Java 21 | TESTS | 21 | 203 | 614400 | ||
| 359441221 | absolutabhay | D1 | Jan. 23, 2026, 4:26 p.m. | OK | Java 21 | TESTS | 21 | 234 | 614400 | ||
| 359438915 | thesaurabhmishra001 | D1 | Jan. 23, 2026, 4:22 p.m. | OK | Java 21 | TESTS | 21 | 234 | 614400 | ||
| 359459192 | hg_2005 | D1 | Jan. 23, 2026, 6:10 p.m. | OK | Java 21 | TESTS | 21 | 234 | 1433600 | ||
| 359454445 | BurnerAce | D1 | Jan. 23, 2026, 5:36 p.m. | OK | Java 21 | TESTS | 21 | 250 | 716800 | ||
| 359439569 | kit28.24bec094 | D1 | Jan. 23, 2026, 4:24 p.m. | OK | Java 21 | TESTS | 21 | 250 | 716800 | ||
| 359442153 | abhikchau | D1 | Jan. 23, 2026, 4:28 p.m. | OK | Java 21 | TESTS | 21 | 250 | 921600 | ||
| 359478691 | wenbozh | D1 | Jan. 23, 2026, 10:12 p.m. | OK | Java 21 | TESTS | 21 | 265 | 614400 | ||
| 359446225 | dhroovs | D1 | Jan. 23, 2026, 4:34 p.m. | OK | Java 21 | TESTS | 21 | 265 | 1228800 | ||
| 359442456 | pranjulsaxena682 | D1 | Jan. 23, 2026, 4:28 p.m. | OK | Java 21 | TESTS | 21 | 343 | 1024000 | ||
| 359477697 | Vishmiya_61 | D1 | Jan. 23, 2026, 9:49 p.m. | OK | Java 8 | TESTS | 21 | 140 | 0 | ||
| 359443764 | kit27.bme03 | D1 | Jan. 23, 2026, 4:30 p.m. | OK | Java 8 | TESTS | 21 | 140 | 0 | ||
| 359476201 | kevin_0911 | D1 | Jan. 23, 2026, 9:20 p.m. | OK | Java 8 | TESTS | 21 | 218 | 0 | ||
| 359481061 | tin.le2 | D1 | Jan. 23, 2026, 11:23 p.m. | OK | Kotlin 1.7 | TESTS | 21 | 375 | 12902400 | ||
| 359461262 | SanjarAlgo | D1 | Jan. 23, 2026, 6:24 p.m. | OK | PascalABC.NET | TESTS | 21 | 218 | 1126400 | ||
| 359488122 | kaushik.atla | D1 | Jan. 24, 2026, 2:45 a.m. | OK | PyPy 3-64 | TESTS | 21 | 78 | 4403200 | ||
| 359449981 | akane646 | D1 | Jan. 23, 2026, 5:09 p.m. | OK | PyPy 3-64 | TESTS | 21 | 93 | 4096000 | ||
| 359453544 | Itx_Hassan | D1 | Jan. 23, 2026, 5:30 p.m. | OK | PyPy 3-64 | TESTS | 21 | 93 | 5836800 | ||
| 359439731 | jgs03177 | D1 | Jan. 23, 2026, 4:24 p.m. | OK | PyPy 3-64 | TESTS | 21 | 109 | 3993600 | ||
| 359499052 | sushmanth.dampur8780 | D1 | Jan. 24, 2026, 5:21 a.m. | OK | PyPy 3-64 | TESTS | 21 | 109 | 5222400 | ||
| 359487213 | kaedeeeee | D1 | Jan. 24, 2026, 2:27 a.m. | OK | PyPy 3-64 | TESTS | 21 | 109 | 5427200 | ||
| 359446445 | NisshchayaRathi | D1 | Jan. 23, 2026, 4:34 p.m. | OK | PyPy 3-64 | TESTS | 21 | 109 | 5939200 | ||
| 359460761 | Fishion | D1 | Jan. 23, 2026, 6:21 p.m. | OK | PyPy 3-64 | TESTS | 21 | 109 | 6041600 | ||
| 359449460 | sushmanth.dampur8780 | D1 | Jan. 23, 2026, 5:07 p.m. | OK | PyPy 3-64 | TESTS | 21 | 125 | 5222400 | ||
| 359444663 | Azusa | D1 | Jan. 23, 2026, 4:32 p.m. | OK | PyPy 3-64 | TESTS | 21 | 125 | 6451200 | ||
| 359439353 | bajpai06 | D1 | Jan. 23, 2026, 4:23 p.m. | OK | Python 3 | TESTS | 21 | 125 | 2969600 | ||
| 359446303 | road2qnt | D1 | Jan. 23, 2026, 4:34 p.m. | OK | Python 3 | TESTS | 21 | 140 | 716800 |
Back to search problems