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"You are given two positive integers, a and b ( a < b ). For some positive integer n , two players will play a game starting with a pile of n stones. They take turns removing exactly a or exactly b stones from the pile. The player who is unable to make a move loses. Find a positive integer n such that the second player to move in this game has a winning strategy. This means that no matter what moves the first player makes, the second player can carefully choose their moves (possibly depending on the first player's moves) to ensure they win. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 100 ). The description of the test cases follows. The only line of each test case contains two integers, a and b ( 1 <= a < b <= 100 ). For each test case, output any positive integer n ( 1 <= n <= 10^6 ) such that the second player to move wins. It can be proven that such an n always exists under the constraints of the problem. In the first test case, when n = 2 , the first player must remove a = 1 stone. Then, the second player can respond by removing a = 1 stone. The first player can no longer make a move, so the second player wins. In the second test case, when n = 6 , the first player has two options: In the third test case, the first player cannot make any moves when n = 3 , so the second player immediately wins. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
213443039 |
lAMaLOSER |
A |
July 12, 2023, 2:32 a.m. |
OK |
C# 10 |
TESTS |
7 |
46 |
0 |
|
|
213426009 |
bluemegane |
A |
July 11, 2023, 9:56 p.m. |
OK |
C# 8 |
TESTS |
7 |
109 |
102400 |
|
|
213415324 |
ERROR_NOOB |
A |
July 11, 2023, 7:31 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
7 |
31 |
0 |
|
|
213435964 |
zcyyyds |
A |
July 12, 2023, 1:06 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
7 |
31 |
0 |
|
|
213410724 |
Unintelligent_ |
A |
July 11, 2023, 6:45 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
7 |
31 |
0 |
|
|
213421462 |
NenadDapic |
A |
July 11, 2023, 8:43 p.m. |
OK |
FPC |
TESTS |
7 |
15 |
0 |
|
|
213396251 |
kasarlasunilkumar676 |
A |
July 11, 2023, 5:15 p.m. |
OK |
GNU C11 |
TESTS |
6 |
15 |
0 |
|
|
213406720 |
zubaxer |
A |
July 11, 2023, 6:15 p.m. |
OK |
GNU C11 |
TESTS |
6 |
15 |
0 |
|
|
213436973 |
peterlatef3 |
A |
July 12, 2023, 1:18 a.m. |
OK |
GNU C11 |
TESTS |
7 |
15 |
0 |
|
|
213444481 |
Pritom13076 |
A |
July 12, 2023, 2:48 a.m. |
OK |
GNU C11 |
TESTS |
7 |
15 |
0 |
|
|
213453447 |
jayanth26 |
A |
July 12, 2023, 5:06 a.m. |
OK |
GNU C11 |
TESTS |
7 |
15 |
0 |
|
|
213419921 |
Hacv16 |
A |
July 11, 2023, 8:24 p.m. |
OK |
GNU C11 |
TESTS |
7 |
30 |
0 |
|
|
213455745 |
Surendra_22 |
A |
July 12, 2023, 5:42 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213454603 |
quocdung2603 |
A |
July 12, 2023, 5:24 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213453718 |
gsc0618china |
A |
July 12, 2023, 5:10 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213453708 |
ljyyyds5 |
A |
July 12, 2023, 5:10 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213452263 |
saranshbairagi |
A |
July 12, 2023, 4:47 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213450972 |
retard_solver |
A |
July 12, 2023, 4:26 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213450324 |
arun_kr |
A |
July 12, 2023, 4:14 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213450167 |
amit_tp.02 |
A |
July 12, 2023, 4:11 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213448392 |
include_BM |
A |
July 12, 2023, 3:42 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213456471 |
22ucs124 |
A |
July 12, 2023, 5:53 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
0 |
|
|
213456120 |
Immortal_007 |
A |
July 12, 2023, 5:48 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213456011 |
Rana_Jay_31 |
A |
July 12, 2023, 5:46 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213455758 |
not_deepanshu |
A |
July 12, 2023, 5:42 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213455690 |
Madhav_Singh |
A |
July 12, 2023, 5:41 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213456716 |
GeminiStar |
A |
July 12, 2023, 5:57 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213456718 |
practice_for_problem |
A |
July 12, 2023, 5:57 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213456873 |
michael0605 |
A |
July 12, 2023, 6 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213456913 |
omkarphansopkar |
A |
July 12, 2023, 6 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213457117 |
shaksham26 |
A |
July 12, 2023, 6:03 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213456595 |
_gg_4INF |
A |
July 12, 2023, 5:55 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
0 |
|
|
213437893 |
Ccii |
A |
July 12, 2023, 1:30 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213456883 |
skartik |
A |
July 12, 2023, 6 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213456314 |
Chinayz |
A |
July 12, 2023, 5:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213455131 |
Carsoncyc |
A |
July 12, 2023, 5:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213453944 |
Akagi_Ritsuko_219 |
A |
July 12, 2023, 5:13 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213445389 |
walilili |
A |
July 12, 2023, 2:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213444020 |
tan.star |
A |
July 12, 2023, 2:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213438667 |
harishbs |
A |
July 12, 2023, 1:40 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213437344 |
xiangyi1 |
A |
July 12, 2023, 1:23 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213436700 |
CeleryFish |
A |
July 12, 2023, 1:15 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
0 |
|
|
213456054 |
Ikuyo |
A |
July 12, 2023, 5:47 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213455957 |
ProgramMastergg |
A |
July 12, 2023, 5:45 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213455506 |
ritik02122002 |
A |
July 12, 2023, 5:39 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213455275 |
Tkehsihba |
A |
July 12, 2023, 5:35 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213456127 |
XY_Eleven |
A |
July 12, 2023, 5:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213456493 |
faris007 |
A |
July 12, 2023, 5:53 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213456646 |
Sanginov |
A |
July 12, 2023, 5:56 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213456940 |
NasorHidar |
A |
July 12, 2023, 6:01 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213457004 |
jxyash |
A |
July 12, 2023, 6:02 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213457133 |
swarnimjain004 |
A |
July 12, 2023, 6:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
0 |
|
|
213413155 |
Arnab_11 |
A |
July 11, 2023, 7:07 p.m. |
OK |
Go |
TESTS |
7 |
15 |
0 |
|
|
213439302 |
vivekmurali2k |
A |
July 12, 2023, 1:48 a.m. |
OK |
Go |
TESTS |
7 |
31 |
0 |
|
|
213420061 |
overlordin777 |
A |
July 11, 2023, 8:26 p.m. |
OK |
Haskell |
TESTS |
7 |
15 |
0 |
|
|
213413494 |
Nesta |
A |
July 11, 2023, 7:10 p.m. |
OK |
Haskell |
TESTS |
7 |
15 |
0 |
|
|
213409668 |
ttannishh |
A |
July 11, 2023, 6:36 p.m. |
OK |
Java 11 |
TESTS |
7 |
155 |
0 |
|
|
213406382 |
varahamihira_ |
A |
July 11, 2023, 6:13 p.m. |
OK |
Java 11 |
TESTS |
6 |
155 |
0 |
|
|
213431336 |
EricM08 |
A |
July 11, 2023, 11:49 p.m. |
OK |
Java 11 |
TESTS |
7 |
170 |
0 |
|
|
213455887 |
SAY_NO_TO_EDITORIAL |
A |
July 12, 2023, 5:44 a.m. |
OK |
Java 11 |
TESTS |
7 |
170 |
39116800 |
|
|
213433692 |
mschact |
A |
July 12, 2023, 12:34 a.m. |
OK |
Java 11 |
TESTS |
7 |
171 |
0 |
|
|
213413840 |
Gaurav__sharma |
A |
July 11, 2023, 7:15 p.m. |
OK |
Java 11 |
TESTS |
7 |
171 |
0 |
|
|
213411044 |
LeeIdol |
A |
July 11, 2023, 6:47 p.m. |
OK |
Java 11 |
TESTS |
7 |
171 |
0 |
|
|
213426100 |
Juker |
A |
July 11, 2023, 9:58 p.m. |
OK |
Java 11 |
TESTS |
7 |
186 |
0 |
|
|
213419939 |
mschact |
A |
July 11, 2023, 8:24 p.m. |
OK |
Java 11 |
TESTS |
7 |
187 |
0 |
|
|
213409431 |
bhushan2311 |
A |
July 11, 2023, 6:34 p.m. |
OK |
Java 11 |
TESTS |
7 |
187 |
0 |
|
|
213400000 |
_Abhinavv_ |
A |
July 11, 2023, 5:27 p.m. |
OK |
Java 17 |
TESTS |
6 |
139 |
0 |
|
|
213405740 |
Nagendravarma |
A |
July 11, 2023, 6:10 p.m. |
OK |
Java 17 |
TESTS |
6 |
171 |
409600 |
|
|
213413059 |
codebook_2000 |
A |
July 11, 2023, 7:06 p.m. |
OK |
Java 17 |
TESTS |
7 |
171 |
512000 |
|
|
213440946 |
chuquwan9964 |
A |
July 12, 2023, 2:07 a.m. |
OK |
Java 17 |
TESTS |
7 |
171 |
512000 |
|
|
213432905 |
anand_mishra_ |
A |
July 12, 2023, 12:20 a.m. |
OK |
Java 17 |
TESTS |
7 |
171 |
1126400 |
|
|
213410416 |
swatishivam23 |
A |
July 11, 2023, 6:42 p.m. |
OK |
Java 17 |
TESTS |
7 |
187 |
102400 |
|
|
213409919 |
swatishivam23 |
A |
July 11, 2023, 6:38 p.m. |
OK |
Java 17 |
TESTS |
7 |
187 |
409600 |
|
|
213425226 |
balajirudrawar123 |
A |
July 11, 2023, 9:41 p.m. |
OK |
Java 17 |
TESTS |
7 |
187 |
409600 |
|
|
213413226 |
Danger_Don |
A |
July 11, 2023, 7:08 p.m. |
OK |
Java 17 |
TESTS |
7 |
187 |
409600 |
|
|
213422167 |
Vrutik_2809 |
A |
July 11, 2023, 8:53 p.m. |
OK |
Java 17 |
TESTS |
7 |
187 |
512000 |
|
|
213406656 |
sashaaaaa |
A |
July 11, 2023, 6:15 p.m. |
OK |
Java 8 |
TESTS |
6 |
92 |
0 |
|
|
213427764 |
raj_shahh |
A |
July 11, 2023, 10:30 p.m. |
OK |
Java 8 |
TESTS |
7 |
93 |
0 |
|
|
213418200 |
iamdimonis |
A |
July 11, 2023, 8:04 p.m. |
OK |
Java 8 |
TESTS |
7 |
93 |
0 |
|
|
213393560 |
zebs |
A |
July 11, 2023, 5:06 p.m. |
OK |
Java 8 |
TESTS |
6 |
108 |
0 |
|
|
213410189 |
Sumitsingh7 |
A |
July 11, 2023, 6:40 p.m. |
OK |
Java 8 |
TESTS |
7 |
108 |
5632000 |
|
|
213422957 |
singhshanu51 |
A |
July 11, 2023, 9:04 p.m. |
OK |
Java 8 |
TESTS |
7 |
109 |
0 |
|
|
213444639 |
ab411 |
A |
July 12, 2023, 2:49 a.m. |
OK |
Java 8 |
TESTS |
7 |
124 |
0 |
|
|
213418847 |
bhavesh555 |
A |
July 11, 2023, 8:12 p.m. |
OK |
Java 8 |
TESTS |
7 |
124 |
0 |
|
|
213406668 |
pcm_op |
A |
July 11, 2023, 6:15 p.m. |
OK |
Java 8 |
TESTS |
6 |
140 |
0 |
|
|
213453317 |
bianLiangMing |
A |
July 12, 2023, 5:04 a.m. |
OK |
JavaScript |
TESTS |
7 |
15 |
0 |
|
|
213408838 |
ma7ameee7o0o |
A |
July 11, 2023, 6:30 p.m. |
OK |
JavaScript |
TESTS |
7 |
31 |
0 |
|
|
213451177 |
Mhmd_Bakr |
A |
July 12, 2023, 4:30 a.m. |
OK |
Mono C# |
TESTS |
7 |
46 |
0 |
|
|
213446486 |
YangZyi |
A |
July 12, 2023, 3:15 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
0 |
0 |
|
|
213453925 |
Nanase_ai |
A |
July 12, 2023, 5:13 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
0 |
0 |
|
|
213435374 |
ishybee |
A |
July 12, 2023, 12:58 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
0 |
0 |
|
|
213416224 |
Aneeba |
A |
July 11, 2023, 7:41 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
0 |
0 |
|
|
213411302 |
ch21btech11036 |
A |
July 11, 2023, 6:50 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
0 |
0 |
|
|
213433716 |
Aksurana |
A |
July 12, 2023, 12:34 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
15 |
0 |
|
|
213451327 |
SimranBishnoi |
A |
July 12, 2023, 4:32 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
62 |
0 |
|
|
213397897 |
Slmn002 |
A |
July 11, 2023, 5:20 p.m. |
OK |
PyPy 3 |
TESTS |
6 |
77 |
0 |
|
|
213418692 |
_u_n_k_n_o_w_n_ |
A |
July 11, 2023, 8:10 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
77 |
0 |
|
|
213414641 |
jvatsal0709 |
A |
July 11, 2023, 7:24 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
77 |
0 |
|
|
213412196 |
circle977 |
A |
July 11, 2023, 6:58 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
77 |
0 |
|
|
213406527 |
varahamihira_ |
A |
July 11, 2023, 6:14 p.m. |
OK |
PyPy 3 |
TESTS |
6 |
77 |
0 |
|
|
213409650 |
circle977 |
A |
July 11, 2023, 6:35 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
92 |
0 |
|
|
213452968 |
nightHawk18 |
A |
July 12, 2023, 4:58 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
93 |
0 |
|
|
213451241 |
SimranBishnoi |
A |
July 12, 2023, 4:31 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
93 |
0 |
|
|
213440671 |
ax216 |
A |
July 12, 2023, 2:04 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
93 |
0 |
|
|
213449126 |
brimstone |
A |
July 12, 2023, 3:54 a.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
46 |
0 |
|
|
213446630 |
BlueGlaucus1 |
A |
July 12, 2023, 3:17 a.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
46 |
0 |
|
|
213446620 |
Youarenotgood |
A |
July 12, 2023, 3:17 a.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
46 |
0 |
|
|
213417970 |
vishu.ut |
A |
July 11, 2023, 8:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
46 |
0 |
|
|
213415413 |
damya |
A |
July 11, 2023, 7:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
46 |
0 |
|
|
213410330 |
ahmedabdelbakey7 |
A |
July 11, 2023, 6:41 p.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
46 |
0 |
|
|
213407741 |
theRealChainman |
A |
July 11, 2023, 6:22 p.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
46 |
0 |
|
|
213407479 |
AbdulRahmanLuai |
A |
July 11, 2023, 6:20 p.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
46 |
0 |
|
|
213453957 |
Aksh4t-45 |
A |
July 12, 2023, 5:14 a.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
61 |
0 |
|
|
213443460 |
whysoseriousQAQ |
A |
July 12, 2023, 2:37 a.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
61 |
0 |
|
|
213413797 |
MutedSolace |
A |
July 11, 2023, 7:14 p.m. |
OK |
Python 3 |
TESTS |
7 |
30 |
0 |
|
|
213453034 |
kovir_aleksey_korroy |
A |
July 12, 2023, 4:59 a.m. |
OK |
Python 3 |
TESTS |
7 |
31 |
0 |
|
|
213448500 |
Shuja_SundarSTEM |
A |
July 12, 2023, 3:44 a.m. |
OK |
Python 3 |
TESTS |
7 |
31 |
0 |
|
|
213420908 |
eugalt |
A |
July 11, 2023, 8:37 p.m. |
OK |
Python 3 |
TESTS |
7 |
31 |
0 |
|
|
213416843 |
IgorA |
A |
July 11, 2023, 7:47 p.m. |
OK |
Python 3 |
TESTS |
7 |
31 |
0 |
|
|
213414147 |
chaitanya1023 |
A |
July 11, 2023, 7:18 p.m. |
OK |
Python 3 |
TESTS |
7 |
31 |
0 |
|
|
213412795 |
thisisprashantmishra |
A |
July 11, 2023, 7:03 p.m. |
OK |
Python 3 |
TESTS |
7 |
31 |
0 |
|
|
213411784 |
Leeisateam |
A |
July 11, 2023, 6:54 p.m. |
OK |
Python 3 |
TESTS |
7 |
31 |
0 |
|
|
213407642 |
syedazhar1210 |
A |
July 11, 2023, 6:21 p.m. |
OK |
Python 3 |
TESTS |
7 |
31 |
0 |
|
|
213399995 |
akshitha_1705 |
A |
July 11, 2023, 5:27 p.m. |
OK |
Python 3 |
TESTS |
6 |
31 |
0 |
|
|
213421133 |
circle977 |
A |
July 11, 2023, 8:40 p.m. |
OK |
Ruby 3 |
TESTS |
7 |
187 |
0 |
|
|
213417728 |
crut |
A |
July 11, 2023, 7:59 p.m. |
OK |
Ruby 3 |
TESTS |
7 |
217 |
102400 |
|
|
213421244 |
circle977 |
A |
July 11, 2023, 8:41 p.m. |
OK |
Ruby 3 |
TESTS |
7 |
233 |
102400 |
|
|
213394922 |
vivek__jaiswal |
A |
July 11, 2023, 5:10 p.m. |
OK |
Ruby 3 |
TESTS |
6 |
233 |
204800 |
|
|
213404782 |
0x81 |
A |
July 11, 2023, 6:05 p.m. |
OK |
Ruby 3 |
TESTS |
6 |
233 |
307200 |
|
|
213455950 |
a1000 |
A |
July 12, 2023, 5:45 a.m. |
OK |
Rust 2021 |
TESTS |
7 |
0 |
0 |
|
|
213419774 |
cptahahab |
A |
July 11, 2023, 8:22 p.m. |
OK |
Rust 2021 |
TESTS |
7 |
15 |
0 |
|
|
213405816 |
DreadedHippy |
A |
July 11, 2023, 6:10 p.m. |
OK |
Rust 2021 |
TESTS |
6 |
15 |
0 |
|
|
remove filters
Back to search problems