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"Alice and Bob play a game. The game consists of several sets, and each set consists of several rounds. Each round is won either by Alice or by Bob, and the set ends when one of the players has won x rounds in a row. For example, if Bob won five rounds in a row and x = 2 , then two sets ends. You know that Alice and Bob have already played n rounds, and you know the results of some rounds. For each x from 1 to n , calculate the maximum possible number of sets that could have already finished if each set lasts until one of the players wins x rounds in a row. It is possible that the last set is still not finished -- in that case, you should not count it in the answer. The first line contains one integer n ( 1 <= n <= 10^6 ) -- the number of rounds. The second line contains one string s of length n -- the descriptions of rounds. If the i -th element of the string is 0, then Alice won the i -th round; if it is 1, then Bob won the i -th round, and if it is ?, then you don't know who won the i -th round. In the only line print n integers. The i -th integer should be equal to the maximum possible number of sets that could have already finished if each set lasts until one of the players wins i rounds in a row. Let's consider the first test case: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
91186649 |
yasugongshang |
F |
Aug. 28, 2020, 7:08 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
202 |
13004800 |
|
|
90555659 |
jhzjk |
F |
Aug. 21, 2020, 2:56 p.m. |
OK |
GNU C++11 |
TESTS |
70 |
326 |
73318400 |
|
|
90433881 |
ImpcO |
F |
Aug. 20, 2020, 5:13 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
327 |
5017600 |
|
|
91213685 |
rgnerdplayer |
F |
Aug. 28, 2020, 1:51 p.m. |
OK |
GNU C++11 |
TESTS |
70 |
327 |
22425600 |
|
|
90547188 |
jhzjk |
F |
Aug. 21, 2020, 2:47 p.m. |
OK |
GNU C++11 |
TESTS |
70 |
327 |
73318400 |
|
|
90199976 |
13475700246laoye |
F |
Aug. 17, 2020, 6:26 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
358 |
43622400 |
|
|
90677705 |
WaluntOvO |
F |
Aug. 22, 2020, 10:12 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
373 |
45056000 |
|
|
90341281 |
amr962 |
F |
Aug. 18, 2020, 7:44 p.m. |
OK |
GNU C++11 |
TESTS |
70 |
405 |
37580800 |
|
|
90214330 |
Hpnes |
F |
Aug. 17, 2020, 9:38 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
452 |
13004800 |
|
|
90516369 |
Tommy0103 |
F |
Aug. 21, 2020, 8:47 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
467 |
13004800 |
|
|
90319367 |
Wolf. |
F |
Aug. 18, 2020, 2:56 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
187 |
22425600 |
|
|
90204007 |
TheLethalCode |
F |
Aug. 17, 2020, 7:19 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
202 |
51507200 |
|
|
90347099 |
FiveAtomTree |
F |
Aug. 18, 2020, 10:52 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
233 |
22323200 |
|
|
90347183 |
FiveAtomTree |
F |
Aug. 18, 2020, 10:56 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
248 |
22323200 |
|
|
91068518 |
oipotato |
F |
Aug. 26, 2020, 3:25 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
249 |
41267200 |
|
|
91098053 |
oipotato |
F |
Aug. 27, 2020, 2:22 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
249 |
49356800 |
|
|
90358569 |
_Glorious_Days_ |
F |
Aug. 19, 2020, 5:11 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
264 |
38502400 |
|
|
90421617 |
retawB |
F |
Aug. 19, 2020, 9:44 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
265 |
18329600 |
|
|
90253102 |
123thunderbuddie |
F |
Aug. 17, 2020, 5:38 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
327 |
19353600 |
|
|
90678392 |
rivalq |
F |
Aug. 22, 2020, 10:21 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
327 |
33075200 |
|
|
90272175 |
Giantpizzahead |
F |
Aug. 18, 2020, 3:05 a.m. |
OK |
GNU C++17 |
TESTS |
70 |
124 |
28057600 |
|
|
90757471 |
ttiiaann32 |
F |
Aug. 23, 2020, 1:08 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
171 |
59084800 |
|
|
90234023 |
ace25 |
F |
Aug. 17, 2020, 1:50 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
186 |
10137600 |
|
|
90716780 |
KrK |
F |
Aug. 22, 2020, 8:57 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
187 |
18124800 |
|
|
90285234 |
htvu |
F |
Aug. 18, 2020, 7:18 a.m. |
OK |
GNU C++17 |
TESTS |
70 |
202 |
43110400 |
|
|
90194623 |
N00Borz |
F |
Aug. 17, 2020, 5:08 a.m. |
OK |
GNU C++17 |
TESTS |
70 |
217 |
41369600 |
|
|
91210421 |
sammithkanur |
F |
Aug. 28, 2020, 1:13 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
218 |
17510400 |
|
|
90261178 |
Radewoosh |
F |
Aug. 17, 2020, 8:06 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
233 |
41472000 |
|
|
91635429 |
vieta |
F |
Sept. 2, 2020, 11:24 a.m. |
OK |
GNU C++17 |
TESTS |
70 |
234 |
18124800 |
|
|
90889602 |
TudorStefan |
F |
Aug. 25, 2020, 10:15 a.m. |
OK |
GNU C++17 |
TESTS |
70 |
249 |
13516800 |
|
|
90790459 |
heyuhhh |
F |
Aug. 24, 2020, 2:16 a.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
140 |
25088000 |
|
|
90407602 |
hello_codeforces |
F |
Aug. 19, 2020, 4:45 p.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
140 |
40038400 |
|
|
90405808 |
hello_codeforces |
F |
Aug. 19, 2020, 4:18 p.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
140 |
42700800 |
|
|
90521787 |
kessido |
F |
Aug. 21, 2020, 10:06 a.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
155 |
48742400 |
|
|
90502100 |
kessido |
F |
Aug. 21, 2020, 1:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
156 |
48742400 |
|
|
90255851 |
Pandemic |
F |
Aug. 17, 2020, 6:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
171 |
28774400 |
|
|
90501953 |
kessido |
F |
Aug. 21, 2020, 1:40 a.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
171 |
57139200 |
|
|
90830300 |
SGHD |
F |
Aug. 24, 2020, 1:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
187 |
17100800 |
|
|
90521397 |
kessido |
F |
Aug. 21, 2020, 10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
202 |
16588800 |
|
|
91669037 |
tryptophan |
F |
Sept. 2, 2020, 6:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
70 |
202 |
22118400 |
|
|
90353340 |
PizzaLovers007 |
F |
Aug. 19, 2020, 2:56 a.m. |
OK |
Java 11 |
TESTS |
70 |
389 |
38400000 |
|
|
90334281 |
hulk_man |
F |
Aug. 18, 2020, 5:49 p.m. |
OK |
Java 8 |
TESTS |
70 |
1169 |
246067200 |
|
|
91257202 |
inesinesines |
F |
Aug. 29, 2020, 5:16 a.m. |
OK |
MS C++ 2017 |
TESTS |
70 |
592 |
9011200 |
|
|
90277189 |
brined_fish |
F |
Aug. 18, 2020, 5:08 a.m. |
OK |
MS C++ 2017 |
TESTS |
70 |
655 |
19046400 |
|
|
91168808 |
yumtam |
F |
Aug. 27, 2020, 9:43 p.m. |
OK |
PyPy 2 |
TESTS |
70 |
997 |
86630400 |
|
|
90900082 |
mkawa2 |
F |
Aug. 25, 2020, 12:46 p.m. |
OK |
PyPy 3 |
TESTS |
70 |
764 |
83148800 |
|
|
90900036 |
mkawa2 |
F |
Aug. 25, 2020, 12:45 p.m. |
OK |
PyPy 3 |
TESTS |
70 |
764 |
147968000 |
|
|
90494915 |
IPhO |
F |
Aug. 20, 2020, 8:31 p.m. |
OK |
PyPy 3 |
TESTS |
70 |
1996 |
249344000 |
|
|
90289733 |
sansen |
F |
Aug. 18, 2020, 8:21 a.m. |
OK |
Rust |
TESTS |
70 |
561 |
10035200 |
|
|
91427069 |
sslotin |
F |
Aug. 30, 2020, 6:05 p.m. |
OK |
Rust |
TESTS |
70 |
1076 |
130969600 |
|
|
remove filters
Back to search problems