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'Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n . Players make the following move in turns: A tree is a connected undirected graph without cycles. There is a special node numbered x . The player who removes this node wins the game. Ayush moves first. Determine the winner of the game if each player plays optimally. The first line of the input contains a single integer t (1 <= q t <= q 10) -- the number of testcases. The description of the test cases follows. The first line of each testcase contains two integers n and x (1 <= q n <= q 1000, 1 <= q x <= q n) -- the number of nodes in the tree and the special node respectively. Each of the next n-1 lines contain two integers u , v (1 <= q u, v <= q n, text{ } u ne v) , meaning that there is an edge between nodes u and v in the tree. For every test case, if Ayush wins the game, print "Ayush", otherwise print "Ashish" (without quotes). For the 1 st test case, Ayush can only remove node 2 or 3 , after which node 1 becomes a leaf node and Ashish can remove it in his turn. For the 2 nd test case, Ayush can remove node 2 in the first move itself. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
82390682 |
ijk13 |
C |
June 3, 2020, 11:25 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
51 |
109 |
0 |
|
1600 |
82167315 |
QScloud |
C |
June 1, 2020, 12:25 a.m. |
OK |
GNU C11 |
TESTS |
51 |
30 |
4096000 |
|
1600 |
82181773 |
Tharani_priya |
C |
June 1, 2020, 5:54 a.m. |
OK |
GNU C11 |
TESTS |
51 |
30 |
4096000 |
|
1600 |
82201050 |
saikowsik11 |
C |
June 1, 2020, 9:39 a.m. |
OK |
GNU C11 |
TESTS |
51 |
31 |
0 |
|
1600 |
82395619 |
dongri |
C |
June 3, 2020, 12:25 p.m. |
OK |
GNU C11 |
TESTS |
51 |
31 |
0 |
|
1600 |
82157153 |
SUNNY24 |
C |
May 31, 2020, 7:35 p.m. |
OK |
GNU C11 |
TESTS |
51 |
31 |
0 |
|
1600 |
82148407 |
mrickar |
C |
May 31, 2020, 5:54 p.m. |
OK |
GNU C11 |
TESTS |
50 |
31 |
0 |
|
1600 |
82156857 |
rainboy |
C |
May 31, 2020, 7:31 p.m. |
OK |
GNU C11 |
TESTS |
51 |
31 |
0 |
|
1600 |
82230940 |
Meharaj_mithu |
C |
June 1, 2020, 3:08 p.m. |
OK |
GNU C11 |
TESTS |
51 |
31 |
204800 |
|
1600 |
82306364 |
ja1467 |
C |
June 2, 2020, 12:26 p.m. |
OK |
GNU C11 |
TESTS |
51 |
46 |
0 |
|
1600 |
82190946 |
Polaris_Dane |
C |
June 1, 2020, 7:46 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
30 |
0 |
|
1600 |
82448978 |
luogu_bot1 |
C |
June 4, 2020, 5:11 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
30 |
0 |
|
1600 |
82448993 |
luogu_bot3 |
C |
June 4, 2020, 5:12 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
30 |
0 |
|
1600 |
82213834 |
do_while_true |
C |
June 1, 2020, 12:03 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
30 |
204800 |
|
1600 |
82213856 |
fly-fish |
C |
June 1, 2020, 12:04 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
30 |
204800 |
|
1600 |
82285061 |
scimoon |
C |
June 2, 2020, 8:15 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
30 |
307200 |
|
1600 |
82373199 |
yasugongshang |
C |
June 3, 2020, 7:50 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
30 |
409600 |
|
1600 |
82457569 |
master_rat1 |
C |
June 4, 2020, 7:18 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
1600 |
82444080 |
wegame10086 |
C |
June 4, 2020, 3:08 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
1600 |
82468244 |
wenzhuan |
C |
June 4, 2020, 9:30 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
1600 |
82358739 |
josh-lind |
C |
June 3, 2020, 4:10 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82362120 |
vixx_ |
C |
June 3, 2020, 5:22 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82367889 |
FrozenBeast028 |
C |
June 3, 2020, 6:45 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82401551 |
snape_here |
C |
June 3, 2020, 1:39 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82421570 |
Ashes47 |
C |
June 3, 2020, 5:20 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82436130 |
edge555 |
C |
June 3, 2020, 9:58 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82441699 |
_Cardinal |
C |
June 4, 2020, 1:52 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82450982 |
codemart786 |
C |
June 4, 2020, 5:48 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82455299 |
navy5356 |
C |
June 4, 2020, 6:49 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82362053 |
pratik_gl |
C |
June 3, 2020, 5:21 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
1600 |
82426475 |
hiddenStudent |
C |
June 3, 2020, 6:27 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82482791 |
eamon831 |
C |
June 4, 2020, 12:41 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82425438 |
Dragnil_ |
C |
June 3, 2020, 6:11 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82423149 |
fabo3000 |
C |
June 3, 2020, 5:40 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82422725 |
Fiveneves. |
C |
June 3, 2020, 5:34 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82414273 |
ross_specter |
C |
June 3, 2020, 3:56 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82412911 |
R0cket007 |
C |
June 3, 2020, 3:41 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82411673 |
IncandescentPhosphene |
C |
June 3, 2020, 3:28 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82408258 |
avibhar |
C |
June 3, 2020, 2:52 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82403035 |
Zero_IQ |
C |
June 3, 2020, 1:56 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
1600 |
82189877 |
Scissors_Ss |
C |
June 1, 2020, 7:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
30 |
0 |
|
1600 |
82332763 |
prottoyfuad |
C |
June 2, 2020, 5:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
31 |
0 |
|
1600 |
82345832 |
cadugomes |
C |
June 2, 2020, 9:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
31 |
0 |
|
1600 |
82357867 |
xxxuanei |
C |
June 3, 2020, 3:52 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
31 |
0 |
|
1600 |
82381223 |
AayushAC1998 |
C |
June 3, 2020, 9:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
31 |
0 |
|
1600 |
82401366 |
deushiro |
C |
June 3, 2020, 1:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
31 |
0 |
|
1600 |
82438661 |
menna_tallah |
C |
June 3, 2020, 11:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
31 |
0 |
|
1600 |
82440223 |
akifpatel |
C |
June 4, 2020, 1 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
31 |
0 |
|
1600 |
82448171 |
Tzak |
C |
June 4, 2020, 4:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
31 |
0 |
|
1600 |
82328129 |
AcMiner |
C |
June 2, 2020, 4:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
31 |
0 |
|
1600 |
82206601 |
tulindanil |
C |
June 1, 2020, 10:44 a.m. |
OK |
Go |
TESTS |
51 |
46 |
102400 |
|
1600 |
82190749 |
synapse |
C |
June 1, 2020, 7:43 a.m. |
OK |
Go |
TESTS |
51 |
46 |
102400 |
|
1600 |
82147045 |
nsaeki |
C |
May 31, 2020, 5:44 p.m. |
OK |
Go |
TESTS |
50 |
46 |
307200 |
|
1600 |
82174483 |
jenish9599 |
C |
June 1, 2020, 3:51 a.m. |
OK |
Java 11 |
TESTS |
51 |
171 |
0 |
|
1600 |
82348840 |
jakejase2 |
C |
June 2, 2020, 10:55 p.m. |
OK |
Java 11 |
TESTS |
51 |
186 |
0 |
|
1600 |
82217309 |
533.sandyhu |
C |
June 1, 2020, 12:43 p.m. |
OK |
Java 11 |
TESTS |
51 |
186 |
0 |
|
1600 |
82199925 |
devesh08 |
C |
June 1, 2020, 9:26 a.m. |
OK |
Java 11 |
TESTS |
51 |
186 |
0 |
|
1600 |
82175208 |
jenish9599 |
C |
June 1, 2020, 4:06 a.m. |
OK |
Java 11 |
TESTS |
51 |
186 |
0 |
|
1600 |
82224725 |
nikkitikki |
C |
June 1, 2020, 2:07 p.m. |
OK |
Java 11 |
TESTS |
51 |
187 |
0 |
|
1600 |
82432095 |
vickyvanshaj |
C |
June 3, 2020, 8:03 p.m. |
OK |
Java 11 |
TESTS |
51 |
187 |
0 |
|
1600 |
82377662 |
suryansh.official100 |
C |
June 3, 2020, 8:42 a.m. |
OK |
Java 11 |
TESTS |
51 |
187 |
0 |
|
1600 |
82279007 |
rish1124 |
C |
June 2, 2020, 7:03 a.m. |
OK |
Java 11 |
TESTS |
51 |
187 |
0 |
|
1600 |
82251636 |
Apass.Jack |
C |
June 1, 2020, 7:37 p.m. |
OK |
Java 11 |
TESTS |
51 |
187 |
0 |
|
1600 |
82215924 |
mr___hacker____ |
C |
June 1, 2020, 12:27 p.m. |
OK |
Java 8 |
TESTS |
51 |
109 |
0 |
|
1600 |
82194040 |
panchtattva |
C |
June 1, 2020, 8:21 a.m. |
OK |
Java 8 |
TESTS |
51 |
109 |
0 |
|
1600 |
82165869 |
MubtasimShahriar |
C |
May 31, 2020, 11:26 p.m. |
OK |
Java 8 |
TESTS |
51 |
109 |
0 |
|
1600 |
82344624 |
sunnycarlos |
C |
June 2, 2020, 8:33 p.m. |
OK |
Java 8 |
TESTS |
51 |
109 |
0 |
|
1600 |
82307892 |
aditya314 |
C |
June 2, 2020, 12:43 p.m. |
OK |
Java 8 |
TESTS |
51 |
109 |
0 |
|
1600 |
82287863 |
sudhakar005 |
C |
June 2, 2020, 8:45 a.m. |
OK |
Java 8 |
TESTS |
51 |
109 |
0 |
|
1600 |
82373228 |
neeraj96 |
C |
June 3, 2020, 7:51 a.m. |
OK |
Java 8 |
TESTS |
51 |
109 |
0 |
|
1600 |
82217654 |
jrishabh99 |
C |
June 1, 2020, 12:47 p.m. |
OK |
Java 8 |
TESTS |
51 |
109 |
0 |
|
1600 |
82482538 |
labdhi |
C |
June 4, 2020, 12:37 p.m. |
OK |
Java 8 |
TESTS |
51 |
124 |
0 |
|
1600 |
82436055 |
Agnimandur |
C |
June 3, 2020, 9:55 p.m. |
OK |
Java 8 |
TESTS |
51 |
124 |
0 |
|
1600 |
82396826 |
PugachAG |
C |
June 3, 2020, 12:39 p.m. |
OK |
Kotlin |
TESTS |
51 |
124 |
0 |
|
1600 |
82166577 |
Spheniscine |
C |
May 31, 2020, 11:58 p.m. |
OK |
Kotlin |
TESTS |
51 |
124 |
0 |
|
1600 |
82150199 |
Tlatoani |
C |
May 31, 2020, 6:11 p.m. |
OK |
Kotlin |
TESTS |
50 |
140 |
0 |
|
1600 |
82190730 |
UD_xlinsist |
C |
June 1, 2020, 7:43 a.m. |
OK |
Kotlin |
TESTS |
51 |
155 |
0 |
|
1600 |
82149424 |
speshuric |
C |
May 31, 2020, 6:03 p.m. |
OK |
Kotlin |
TESTS |
50 |
171 |
0 |
|
1600 |
82203844 |
peterc |
C |
June 1, 2020, 10:12 a.m. |
OK |
Mono C# |
TESTS |
51 |
62 |
2252800 |
|
1600 |
82433603 |
zahidsheikh |
C |
June 3, 2020, 8:38 p.m. |
OK |
Mono C# |
TESTS |
51 |
62 |
2252800 |
|
1600 |
82143927 |
Kolyanich |
C |
May 31, 2020, 5:27 p.m. |
OK |
Mono C# |
TESTS |
50 |
77 |
1638400 |
|
1600 |
82444035 |
treasuryonly |
C |
June 4, 2020, 3:06 a.m. |
OK |
Mono C# |
TESTS |
51 |
77 |
6758400 |
|
1600 |
82320653 |
_Trung_Nguyen |
C |
June 2, 2020, 3:03 p.m. |
OK |
Mono C# |
TESTS |
51 |
78 |
6758400 |
|
1600 |
82160242 |
Shimi29 |
C |
May 31, 2020, 8:31 p.m. |
OK |
MS C++ |
TESTS |
51 |
46 |
0 |
|
1600 |
82454648 |
vjudge4 |
C |
June 4, 2020, 6:40 a.m. |
OK |
MS C++ |
TESTS |
51 |
46 |
0 |
|
1600 |
82174514 |
_remake_ |
C |
June 1, 2020, 3:51 a.m. |
OK |
MS C++ |
TESTS |
51 |
46 |
4403200 |
|
1600 |
82172283 |
_remake_ |
C |
June 1, 2020, 3:02 a.m. |
OK |
MS C++ |
TESTS |
51 |
62 |
4403200 |
|
1600 |
82250382 |
The.Cursed.Mage |
C |
June 1, 2020, 7:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
31 |
409600 |
|
1600 |
82409595 |
leventa |
C |
June 3, 2020, 3:05 p.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
31 |
409600 |
|
1600 |
82331515 |
ilya_totl |
C |
June 2, 2020, 5:06 p.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
46 |
0 |
|
1600 |
82357101 |
vjudge1 |
C |
June 3, 2020, 3:36 a.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
46 |
0 |
|
1600 |
82342951 |
JulesIMF |
C |
June 2, 2020, 7:59 p.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
46 |
0 |
|
1600 |
82333057 |
103som |
C |
June 2, 2020, 5:25 p.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
46 |
0 |
|
1600 |
82311868 |
HavardGris |
C |
June 2, 2020, 1:27 p.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
46 |
0 |
|
1600 |
82296367 |
getN1ght |
C |
June 2, 2020, 10:32 a.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
46 |
0 |
|
1600 |
82209725 |
q8_514199 |
C |
June 1, 2020, 11:18 a.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
46 |
0 |
|
1600 |
82189592 |
vjudge5 |
C |
June 1, 2020, 7:30 a.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
46 |
0 |
|
1600 |
82307645 |
yumtam |
C |
June 2, 2020, 12:41 p.m. |
OK |
PyPy 2 |
TESTS |
51 |
140 |
716800 |
|
1600 |
82197083 |
mir.panov |
C |
June 1, 2020, 8:54 a.m. |
OK |
PyPy 2 |
TESTS |
51 |
171 |
1331200 |
|
1600 |
82147959 |
bazzyadb |
C |
May 31, 2020, 5:51 p.m. |
OK |
PyPy 2 |
TESTS |
50 |
218 |
2764800 |
|
1600 |
82171107 |
ergatis |
C |
June 1, 2020, 2:34 a.m. |
OK |
PyPy 2 |
TESTS |
51 |
233 |
1638400 |
|
1600 |
82229211 |
iamprayush |
C |
June 1, 2020, 2:51 p.m. |
OK |
PyPy 2 |
TESTS |
51 |
249 |
9113600 |
|
1600 |
82153704 |
dcordb |
C |
May 31, 2020, 6:49 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
155 |
1945600 |
|
1600 |
82154340 |
KA_Rma |
C |
May 31, 2020, 6:57 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
155 |
2355200 |
|
1600 |
82323148 |
Aestroix |
C |
June 2, 2020, 3:30 p.m. |
OK |
PyPy 3 |
TESTS |
51 |
156 |
1945600 |
|
1600 |
82150967 |
Dewangee |
C |
May 31, 2020, 6:19 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
156 |
2252800 |
|
1600 |
82174756 |
Neotheprogrammer |
C |
June 1, 2020, 3:56 a.m. |
OK |
PyPy 3 |
TESTS |
51 |
156 |
3174400 |
|
1600 |
82192693 |
nikeshthapa255 |
C |
June 1, 2020, 8:06 a.m. |
OK |
PyPy 3 |
TESTS |
51 |
170 |
3174400 |
|
1600 |
82435444 |
UTMoonlight |
C |
June 3, 2020, 9:33 p.m. |
OK |
PyPy 3 |
TESTS |
51 |
171 |
1433600 |
|
1600 |
82233980 |
intekhabalam168 |
C |
June 1, 2020, 3:39 p.m. |
OK |
PyPy 3 |
TESTS |
51 |
171 |
1945600 |
|
1600 |
82220448 |
WA-----Me-----AC |
C |
June 1, 2020, 1:21 p.m. |
OK |
PyPy 3 |
TESTS |
51 |
171 |
1945600 |
|
1600 |
82220348 |
ZeroooIQ |
C |
June 1, 2020, 1:20 p.m. |
OK |
PyPy 3 |
TESTS |
51 |
171 |
1945600 |
|
1600 |
82175449 |
nandarustam |
C |
June 1, 2020, 4:11 a.m. |
OK |
Python 2 |
TESTS |
51 |
187 |
102400 |
|
1600 |
82399696 |
Pavs |
C |
June 3, 2020, 1:17 p.m. |
OK |
Python 2 |
TESTS |
51 |
187 |
204800 |
|
1600 |
82176437 |
nebocco |
C |
June 1, 2020, 4:30 a.m. |
OK |
Python 3 |
TESTS |
51 |
109 |
307200 |
|
1600 |
82406280 |
adyrek |
C |
June 3, 2020, 2:32 p.m. |
OK |
Python 3 |
TESTS |
51 |
124 |
0 |
|
1600 |
82385023 |
aaaaaaaaaa2230 |
C |
June 3, 2020, 10:15 a.m. |
OK |
Python 3 |
TESTS |
51 |
124 |
0 |
|
1600 |
82317441 |
...I_am_Kira... |
C |
June 2, 2020, 2:29 p.m. |
OK |
Python 3 |
TESTS |
51 |
124 |
0 |
|
1600 |
82301297 |
rel4pss |
C |
June 2, 2020, 11:29 a.m. |
OK |
Python 3 |
TESTS |
51 |
124 |
0 |
|
1600 |
82195875 |
Drago_ |
C |
June 1, 2020, 8:41 a.m. |
OK |
Python 3 |
TESTS |
51 |
124 |
0 |
|
1600 |
82166678 |
BlackBear |
C |
June 1, 2020, 12:02 a.m. |
OK |
Python 3 |
TESTS |
51 |
124 |
0 |
|
1600 |
82165555 |
GTrigger |
C |
May 31, 2020, 11:11 p.m. |
OK |
Python 3 |
TESTS |
51 |
124 |
0 |
|
1600 |
82156148 |
aravindreddy.mokireddy |
C |
May 31, 2020, 7:21 p.m. |
OK |
Python 3 |
TESTS |
51 |
124 |
0 |
|
1600 |
82165377 |
GTrigger |
C |
May 31, 2020, 11:03 p.m. |
OK |
Python 3 |
TESTS |
51 |
124 |
102400 |
|
1600 |
82317100 |
pandrei |
C |
June 2, 2020, 2:26 p.m. |
OK |
Rust |
TESTS |
51 |
46 |
102400 |
|
1600 |
remove filters
Back to search problems