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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
1266
|
Codeforces Global Round 6 |
FINISHED |
False |
9000 |
160844087 |
Dec. 17, 2019, 3:05 p.m. |
Problems
B"There is a directed graph on n vertices numbered 1 through n where each vertex (except n ) has two outgoing arcs, red and blue. At any point in time, exactly one of the arcs is active for each vertex. Initially, all blue arcs are active and there is a token located at vertex 1 . In one second, the vertex with token first switches its active arcs -- the inactive arc becomes active and vice versa. Then, the token is moved along the active arc. When the token reaches the vertex n , it stops. It is guaranteed that n is reachable via arcs from every vertex. You are given q queries. Each query contains a state of the graph -- a pair (v, s) of the following form: For each query, determine whether the given state is reachable from the initial state and the first time this configuration appears. Note that the two operations (change active arc and traverse it) are atomic -- a state is not considered reached if it appears after changing the active arc but before traversing it. The first line contains a single integer n ( 2 <= q n <= q 58 ) -- the number of vertices. n-1 lines follow, i -th of contains two space separated integers b_i and r_i ( 1 <= q b_i, r_i <= q n ) representing a blue arc (i, b_i) and red arc (i, r_i) , respectively. It is guaranteed that vertex n is reachable from every vertex. The next line contains a single integer q ( 1 <= q q <= q 5000 ) -- the number of queries. Then q lines with queries follow. The j -th of these lines contains an integer v ( 1 <= q v < n ) and a string s of length n-1 consiting only of characters 'R' and 'B'. The i -th of these characters is 'R' if the red arc going from i is active and 'B' otherwise. Output q lines, each containing answer to a single query. If the state in the i -th query is unreachable, output the integer -1 . Otherwise, out"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
68142693 |
yasugongshang |
H |
Jan. 4, 2020, 12:46 a.m. |
OK |
GNU C++11 |
TESTS |
66 |
483 |
307200 |
|
3400 |
67320658 |
Rubblsh12345 |
H |
Dec. 21, 2019, 7:54 a.m. |
OK |
GNU C++11 |
TESTS |
66 |
1638 |
102400 |
|
3400 |
67159845 |
NikTsDodik |
H |
Dec. 18, 2019, 1:37 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
93 |
204800 |
|
3400 |
67128836 |
Benq |
H |
Dec. 17, 2019, 9:45 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
468 |
307200 |
|
3400 |
67125982 |
ansa |
H |
Dec. 17, 2019, 8:08 p.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
204800 |
|
3400 |
69563075 |
gongsuidashen |
H |
Jan. 26, 2020, 11:22 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
264 |
307200 |
|
3400 |
69469698 |
Atoev__Urvatullo |
H |
Jan. 24, 2020, 2:07 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
265 |
204800 |
|
3400 |
69464240 |
Ismoil_Pariso_Love |
H |
Jan. 24, 2020, 12:09 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
265 |
204800 |
|
3400 |
67185721 |
ecnerwala |
H |
Dec. 19, 2019, 4:29 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
280 |
204800 |
|
3400 |
67689518 |
dimas.kovas |
H |
Dec. 27, 2019, 10:27 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
608 |
409600 |
|
3400 |
67153580 |
paulica |
H |
Dec. 18, 2019, 11:43 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
1762 |
204800 |
|
3400 |
67153432 |
paulica |
H |
Dec. 18, 2019, 11:40 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
1778 |
307200 |
|
3400 |
67129881 |
vinhntndu |
H |
Dec. 17, 2019, 10:41 p.m. |
OK |
Java 11 |
TESTS |
64 |
2074 |
46796800 |
|
3400 |
67118576 |
eatmore |
H |
Dec. 17, 2019, 5:30 p.m. |
OK |
Java 11 |
TESTS |
64 |
2121 |
46796800 |
|
3400 |
remove filters
Back to search problems