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 are playing a game on a graph. They have an undirected graph without self-loops and multiple edges. All vertices of the graph have degree equal to 2 . The graph may consist of several components. Note that if such graph has n vertices, it will have exactly n edges. Alice and Bob take turn. Alice goes first. In each turn, the player can choose k ( l <= k <= r ; l < r ) vertices that form a connected subgraph and erase these vertices from the graph, including all incident edges. The player who can't make a step loses. For example, suppose they are playing on the given graph with given l = 2 and r = 3 : A valid vertex set for Alice to choose at the first move is one of the following: Then a valid vertex set for Bob to choose at the first move is one of the following: Alice can't make a move, so she loses. You are given a graph of size n and integers l and r . Who will win if both Alice and Bob play optimally. The first line contains three integers n , l and r ( 3 <= n <= 2 cdot 10^5 ; 1 <= l < r <= n ) -- the number of vertices in the graph, and the constraints on the number of vertices Alice or Bob can choose in one move. Next n lines contains edges of the graph: one edge per line. The i -th line contains two integers u_i and v_i ( 1 <= u_i, v_i <= n ; u_i neq v_i ) -- description of the i -th edge. It's guaranteed that the degree of each vertex of the given graph is equal to 2 . Print Alice (case-insensitive) if Alice wins, or Bob otherwise. In the first test the same input as in legend is shown. In the second test the same graph as in legend is shown, but with l = 1 and r = 2 . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
203756435 |
lAMaLOSER |
E |
April 28, 2023, 2:21 a.m. |
OK |
C# 10 |
TESTS |
45 |
124 |
13824000 |
|
|
203757545 |
AutumnMist |
E |
April 28, 2023, 2:56 a.m. |
OK |
C# 10 |
TESTS |
45 |
155 |
11878400 |
|
|
203713337 |
mban259 |
E |
April 27, 2023, 4:25 p.m. |
OK |
C# 10 |
TESTS |
45 |
155 |
17612800 |
|
|
203705388 |
Gassa |
E |
April 27, 2023, 3:55 p.m. |
OK |
D |
TESTS |
45 |
202 |
13926400 |
|
|
203712574 |
Buzhibujue |
E |
April 27, 2023, 4:22 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
109 |
3072000 |
|
|
203715675 |
whatss7 |
E |
April 27, 2023, 4:33 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
109 |
4812800 |
|
|
203715199 |
NobodyThere |
E |
April 27, 2023, 4:32 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
109 |
11366400 |
|
|
203757723 |
PCC |
E |
April 28, 2023, 3:02 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
124 |
1638400 |
|
|
203724093 |
Ismail_Alrifai |
E |
April 27, 2023, 5:51 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
124 |
2457600 |
|
|
203756941 |
MakaPakka |
E |
April 28, 2023, 2:36 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
139 |
5632000 |
|
|
203729771 |
mahimero2006 |
E |
April 27, 2023, 6:50 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
139 |
7475200 |
|
|
203712434 |
rfpermen |
E |
April 27, 2023, 4:22 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
140 |
5324800 |
|
|
203757933 |
henrenzhenderen |
E |
April 28, 2023, 3:09 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
140 |
5632000 |
|
|
203717715 |
Taha |
E |
April 27, 2023, 4:56 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
140 |
13004800 |
|
|
remove filters
Back to search problems