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"Omkar and Akmar are playing a game on a circular board with n ( 2 <= q n <= q 10^6 ) cells. The cells are numbered from 1 to n so that for each i ( 1 <= q i <= q n-1 ) cell i is adjacent to cell i+1 and cell 1 is adjacent to cell n . Initially, each cell is empty. Omkar and Akmar take turns placing either an A or a B on the board, with Akmar going first. The letter must be placed on an empty cell. In addition, the letter cannot be placed adjacent to a cell containing the same letter. A player loses when it is their turn and there are no more valid moves. Output the number of possible distinct games where both players play optimally modulo 10^9+7 . Note that we only consider games where some player has lost and there are no more valid moves. Two games are considered distinct if the number of turns is different or for some turn, the letter or cell number that the letter is placed on were different. A move is considered optimal if the move maximizes the player's chance of winning, assuming the other player plays optimally as well. More formally, if the player who has to move has a winning strategy, they have to make a move after which they will still have a winning strategy. If they do not, they can make any move. The only line will contain an integer n ( 2 <= q n <= q 10^6 ) -- the number of cells on the board. Output a single integer -- the number of possible distinct games where both players play optimally modulo 10^9+7 . For the first sample case, the first player has 4 possible moves. No matter what the first player plays, the second player only has 1 possible move, so there are 4 possible games. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
118674356 |
q-w-q-w-q |
F |
June 7, 2021, 1 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
62 |
7987200 |
|
2600 |
118683449 |
RenaMoe |
F |
June 7, 2021, 4:42 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
62 |
7987200 |
|
2600 |
118686388 |
Acfboy |
F |
June 7, 2021, 5:28 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
62 |
15872000 |
|
2600 |
118656463 |
pikapikachu |
F |
June 6, 2021, 5:29 p.m. |
OK |
GNU C++11 |
TESTS |
86 |
62 |
16076800 |
|
2600 |
118681982 |
Inf_Voltage |
F |
June 7, 2021, 4:16 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
77 |
7987200 |
|
2600 |
118647459 |
Lidox1145143344 |
F |
June 6, 2021, 4:20 p.m. |
OK |
GNU C++11 |
TESTS |
86 |
77 |
7987200 |
|
2600 |
118654310 |
casul |
F |
June 6, 2021, 5:16 p.m. |
OK |
GNU C++11 |
TESTS |
86 |
77 |
16076800 |
|
2600 |
118679857 |
Suiseiseki |
F |
June 7, 2021, 3:33 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
78 |
7782400 |
|
2600 |
118675942 |
lsyyds |
F |
June 7, 2021, 2:01 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
78 |
7987200 |
|
2600 |
118675393 |
haojiandan |
F |
June 7, 2021, 1:41 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
78 |
11980800 |
|
2600 |
118674484 |
pratham.programming7 |
F |
June 7, 2021, 1:07 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
62 |
16076800 |
|
2600 |
118681953 |
In_Max |
F |
June 7, 2021, 4:15 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
78 |
7987200 |
|
2600 |
118686211 |
iLoveIOI |
F |
June 7, 2021, 5:25 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
78 |
16076800 |
|
2600 |
118674702 |
Intercept |
F |
June 7, 2021, 1:16 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
78 |
16076800 |
|
2600 |
118673596 |
SuperJ6 |
F |
June 7, 2021, 12:20 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
109 |
24064000 |
|
2600 |
118684714 |
Neal_lee |
F |
June 7, 2021, 5:02 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
124 |
24064000 |
|
2600 |
118672478 |
SuperJ6 |
F |
June 6, 2021, 11:09 p.m. |
OK |
GNU C++14 |
TESTS |
86 |
124 |
24064000 |
|
2600 |
118670776 |
Potassium |
F |
June 6, 2021, 9:39 p.m. |
OK |
GNU C++14 |
TESTS |
86 |
124 |
32051200 |
|
2600 |
118651714 |
AwakeAnay |
F |
June 6, 2021, 4:33 p.m. |
OK |
GNU C++14 |
TESTS |
86 |
452 |
7987200 |
|
2600 |
118650446 |
innocentkitten |
F |
June 6, 2021, 4:29 p.m. |
OK |
GNU C++14 |
TESTS |
86 |
468 |
16076800 |
|
2600 |
118678190 |
Je-O |
F |
June 7, 2021, 2:56 a.m. |
OK |
GNU C++17 |
TESTS |
86 |
62 |
16076800 |
|
2600 |
118648863 |
WA_King |
F |
June 6, 2021, 4:25 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
62 |
16076800 |
|
2600 |
118676342 |
RainAir |
F |
June 7, 2021, 2:13 a.m. |
OK |
GNU C++17 |
TESTS |
86 |
77 |
7987200 |
|
2600 |
118677042 |
ncduy0303 |
F |
June 7, 2021, 2:31 a.m. |
OK |
GNU C++17 |
TESTS |
86 |
77 |
16076800 |
|
2600 |
118654599 |
yukihana0416 |
F |
June 6, 2021, 5:18 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
77 |
24883200 |
|
2600 |
118655216 |
yukihana0416 |
F |
June 6, 2021, 5:21 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
77 |
24883200 |
|
2600 |
118651388 |
darkkcyan |
F |
June 6, 2021, 4:32 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
77 |
28364800 |
|
2600 |
118653762 |
shatovoleg |
F |
June 6, 2021, 5:14 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
93 |
12083200 |
|
2600 |
118654241 |
maximumSHOT |
F |
June 6, 2021, 5:16 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
93 |
16076800 |
|
2600 |
118653861 |
1_16 |
F |
June 6, 2021, 5:14 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
93 |
24064000 |
|
2600 |
118677692 |
AutumnKite |
F |
June 7, 2021, 2:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
7987200 |
|
2600 |
118677133 |
yuzhechuan |
F |
June 7, 2021, 2:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
7987200 |
|
2600 |
118675884 |
Froggygua |
F |
June 7, 2021, 1:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
7987200 |
|
2600 |
118680255 |
annoying_orange |
F |
June 7, 2021, 3:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
7987200 |
|
2600 |
118680097 |
nudun001 |
F |
June 7, 2021, 3:38 a.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
7987200 |
|
2600 |
118677821 |
ToToMI |
F |
June 7, 2021, 2:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
7987200 |
|
2600 |
118656097 |
haruki_K |
F |
June 6, 2021, 5:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
8089600 |
|
2600 |
118685428 |
Nero |
F |
June 7, 2021, 5:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
8089600 |
|
2600 |
118666477 |
tampa |
F |
June 6, 2021, 7:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
8089600 |
|
2600 |
118657371 |
HollwoQ_Pelw |
F |
June 6, 2021, 5:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
86 |
46 |
8192000 |
|
2600 |
118646144 |
uwi |
F |
June 6, 2021, 4:17 p.m. |
OK |
Java 11 |
TESTS |
86 |
327 |
16793600 |
|
2600 |
118682770 |
revanthbhamidipati |
F |
June 7, 2021, 4:30 a.m. |
OK |
Java 11 |
TESTS |
86 |
358 |
16691200 |
|
2600 |
118670120 |
Golovanov399 |
F |
June 6, 2021, 9:13 p.m. |
OK |
Kotlin |
TESTS |
86 |
233 |
23142400 |
|
2600 |
118680109 |
Darooha |
F |
June 7, 2021, 3:39 a.m. |
OK |
Ocaml |
TESTS |
86 |
530 |
22323200 |
|
2600 |
118676032 |
augurar |
F |
June 7, 2021, 2:04 a.m. |
OK |
PyPy 3 |
TESTS |
86 |
576 |
22323200 |
|
2600 |
118651097 |
titia |
F |
June 6, 2021, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
86 |
1435 |
125030400 |
|
2600 |
118684491 |
sh1194 |
F |
June 7, 2021, 4:59 a.m. |
OK |
Python 3 |
TESTS |
86 |
1934 |
40345600 |
|
2600 |
118684208 |
sh1194 |
F |
June 7, 2021, 4:54 a.m. |
OK |
Python 3 |
TESTS |
86 |
1949 |
40345600 |
|
2600 |
118684262 |
sh1194 |
F |
June 7, 2021, 4:55 a.m. |
OK |
Python 3 |
TESTS |
86 |
1996 |
40345600 |
|
2600 |
118662887 |
r57shell |
F |
June 6, 2021, 6:35 p.m. |
OK |
Python 3 |
TESTS |
86 |
2012 |
40345600 |
|
2600 |
remove filters
Back to search problems