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.
Problems
B"Vasya has got an array consisting of n integers, and two integers k and len in addition. All numbers in the array are either between 1 and k (inclusive), or equal to -1 . The array is good if there is no segment of len consecutive equal numbers. Vasya will replace each -1 with some number from 1 to k (inclusive) in such a way that the resulting array is good. Tell him the number of ways to do this replacement. Since the answer may be large, print it modulo 998244353 . The first line contains three integers n, k and len ( 1 <= n <= 10^5, 1 <= k <= 100, 1 <= len <= n ). The second line contains n numbers -- the array. Each number is either -1 or between 1 and k (inclusive). Print one integer -- the number of ways to replace each -1 with some number from 1 to k (inclusive) so the array is good. The answer may be large, so print it modulo 998244353 . Possible answers in the first test: There is no way to make the array good in the second test, since first two elements are equal. There are too many answers in the third test, so we won't describe any of them. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
47700859 |
rainboy |
F |
Dec. 29, 2018, 4:35 p.m. |
OK |
GNU C11 |
TESTS |
20 |
187 |
80998400 |
|
2500 |
47830995 |
dushaolong |
F |
Jan. 2, 2019, 6:43 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
46 |
42905600 |
|
2500 |
47831013 |
dsl2002 |
F |
Jan. 2, 2019, 6:44 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
61 |
42905600 |
|
2500 |
48210678 |
Als123 |
F |
Jan. 11, 2019, 11:49 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
61 |
42905600 |
|
2500 |
47448788 |
CrazyDave |
F |
Dec. 24, 2018, 8:12 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
62 |
42700800 |
|
2500 |
47227515 |
Lych4o_ |
F |
Dec. 18, 2018, 4:51 p.m. |
OK |
GNU C++11 |
TESTS |
20 |
62 |
42905600 |
|
2500 |
47384092 |
tienthanh214 |
F |
Dec. 23, 2018, 2:14 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
62 |
42905600 |
|
2500 |
47132154 |
idxcalccalc |
F |
Dec. 16, 2018, 4:30 p.m. |
OK |
GNU C++11 |
TESTS |
20 |
62 |
43724800 |
|
2500 |
47098864 |
six_solitude |
F |
Dec. 16, 2018, 9:43 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
62 |
88985600 |
|
2500 |
49891268 |
ww3113306 |
F |
Feb. 14, 2019, 3:55 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
62 |
89907200 |
|
2500 |
54787558 |
mzhmxzh |
F |
May 29, 2019, 5:09 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
62 |
150323200 |
|
2500 |
47441335 |
krijgertje |
F |
Dec. 24, 2018, 1:29 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
46 |
3174400 |
|
2500 |
48654460 |
ReaLNero1 |
F |
Jan. 21, 2019, 1:33 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
46 |
3174400 |
|
2500 |
47817780 |
TLE |
F |
Jan. 1, 2019, 3:34 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
46 |
24064000 |
|
2500 |
47282986 |
neal |
F |
Dec. 20, 2018, 3:28 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
46 |
40960000 |
|
2500 |
47282936 |
neal |
F |
Dec. 20, 2018, 3:25 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
61 |
40960000 |
|
2500 |
47282964 |
neal |
F |
Dec. 20, 2018, 3:27 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
61 |
40960000 |
|
2500 |
47282937 |
neal |
F |
Dec. 20, 2018, 3:25 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
61 |
40960000 |
|
2500 |
47282967 |
neal |
F |
Dec. 20, 2018, 3:27 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
61 |
40960000 |
|
2500 |
47282926 |
neal |
F |
Dec. 20, 2018, 3:25 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
61 |
40960000 |
|
2500 |
47282982 |
neal |
F |
Dec. 20, 2018, 3:28 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
61 |
40960000 |
|
2500 |
63524890 |
pootis |
F |
Oct. 27, 2019, 4:57 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
46 |
2867200 |
|
2500 |
47259023 |
vjudge3 |
F |
Dec. 19, 2018, 11:36 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
77 |
44851200 |
|
2500 |
47349913 |
Hugin |
F |
Dec. 22, 2018, 1:15 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
77 |
87040000 |
|
2500 |
49535855 |
aakk |
F |
Feb. 6, 2019, 3:56 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
93 |
43929600 |
|
2500 |
47172838 |
YangDavid |
F |
Dec. 17, 2018, 3:56 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
93 |
44544000 |
|
2500 |
47752278 |
ddpag |
F |
Dec. 30, 2018, 3:49 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
93 |
45875200 |
|
2500 |
50054097 |
oToToT |
F |
Feb. 17, 2019, 9:24 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
93 |
84582400 |
|
2500 |
57187409 |
Seast |
F |
July 17, 2019, 9:08 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
93 |
84992000 |
|
2500 |
47372188 |
_QvQ |
F |
Dec. 22, 2018, 2:56 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
93 |
86630400 |
|
2500 |
47083423 |
Kerim.K |
F |
Dec. 15, 2018, 10:07 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
108 |
42086400 |
|
2500 |
66816798 |
dalt |
F |
Dec. 14, 2019, 6:06 a.m. |
OK |
Java 8 |
TESTS |
20 |
264 |
91136000 |
|
2500 |
47091061 |
7dan |
F |
Dec. 16, 2018, 5:58 a.m. |
OK |
Java 8 |
TESTS |
20 |
374 |
111616000 |
|
2500 |
47706540 |
Dukkha |
F |
Dec. 29, 2018, 8:56 p.m. |
OK |
Java 8 |
TESTS |
20 |
451 |
194150400 |
|
2500 |
66815135 |
dalt |
F |
Dec. 14, 2019, 5:20 a.m. |
OK |
Java 8 |
TESTS |
20 |
467 |
163225600 |
|
2500 |
47514427 |
Morgan_Y |
F |
Dec. 26, 2018, 8:52 a.m. |
OK |
Java 8 |
TESTS |
20 |
561 |
108236800 |
|
2500 |
47517134 |
Ad-007 |
F |
Dec. 26, 2018, 10:42 a.m. |
OK |
Java 8 |
TESTS |
20 |
592 |
144691200 |
|
2500 |
47439540 |
akane_rika |
F |
Dec. 23, 2018, 10:19 p.m. |
OK |
Java 8 |
TESTS |
20 |
608 |
144588800 |
|
2500 |
47270919 |
cgrunau |
F |
Dec. 19, 2018, 4:36 p.m. |
OK |
Java 8 |
TESTS |
20 |
670 |
263065600 |
|
2500 |
48167751 |
jiangzhiyu1987 |
F |
Jan. 10, 2019, 3:33 a.m. |
OK |
Java 8 |
TESTS |
20 |
1341 |
358912000 |
|
2500 |
69594614 |
Guaty |
F |
Jan. 27, 2020, 3:39 a.m. |
OK |
PyPy 3 |
TESTS |
20 |
732 |
54476800 |
|
2500 |
60742875 |
sansen |
F |
Sept. 17, 2019, 9:43 p.m. |
OK |
Rust |
TESTS |
20 |
109 |
44851200 |
|
2500 |
remove filters
Back to search problems