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'Andrew plays a game called "Civilization". Dima helps him. The game has n cities and m bidirectional roads. The cities are numbered from 1 to n. Between any pair of cities there either is a single (unique) path, or there is no path at all. A path is such a sequence of distinct cities v1, xe2 x80 x89v2, xe2 x80 x89..., xe2 x80 x89vk, that there is a road between any contiguous cities vi and vi xe2 x80 x89+ xe2 x80 x891 (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89i xe2 x80 x89< xe2 x80 x89k). The length of the described path equals to (k xe2 x80 x89- xe2 x80 x891). We assume that two cities lie in the same region if and only if, there is a path connecting these two cities. During the game events of two types take place: Dima finds it hard to execute Andrew 's queries, so he asks you to help him. Help Dima. The first line contains three integers n, m, q (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x893 xc2 xb7105; 0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89< xe2 x80 x89n; 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89q xe2 x80 x89 xe2 x89 xa4 xe2 x80 x893 xc2 xb7105) -- the number of cities, the number of the roads we already have and the number of queries, correspondingly. Each of the following m lines contains two integers, ai and bi (ai xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89bi; 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai, xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). These numbers represent the road between cities ai and bi. There can be at most one road between two cities. Each of the following q lines contains one of the two events in the following format: For each event of the first type print the answer on a separate line.'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
41185934 |
Sparky_9 |
C |
Aug. 3, 2018, 4:50 p.m. |
OK |
FPC |
TESTS |
121 |
467 |
42086400 |
|
2200 |
40605342 |
Vixbob |
C |
July 21, 2018, 11:04 a.m. |
OK |
GNU C++ |
TESTS |
121 |
108 |
16179200 |
|
2200 |
40988152 |
ReaLNero1 |
C |
July 30, 2018, 9:46 p.m. |
OK |
GNU C++ |
TESTS |
121 |
109 |
25804800 |
|
2200 |
40605304 |
Vixbob |
C |
July 21, 2018, 11:03 a.m. |
OK |
GNU C++ |
TESTS |
121 |
124 |
16179200 |
|
2200 |
33898151 |
lijiamu |
C |
Jan. 4, 2018, 7:52 a.m. |
OK |
GNU C++ |
TESTS |
121 |
124 |
26112000 |
|
2200 |
39738243 |
zichen0535 |
C |
June 28, 2018, 9:26 a.m. |
OK |
GNU C++ |
TESTS |
121 |
139 |
11468800 |
|
2200 |
39738334 |
vjudge5 |
C |
June 28, 2018, 9:30 a.m. |
OK |
GNU C++ |
TESTS |
121 |
140 |
11468800 |
|
2200 |
40306343 |
vjudge3 |
C |
July 14, 2018, 5:58 a.m. |
OK |
GNU C++ |
TESTS |
121 |
140 |
20684800 |
|
2200 |
40772637 |
vjudge5 |
C |
July 26, 2018, 9:19 a.m. |
OK |
GNU C++ |
TESTS |
121 |
155 |
43417600 |
|
2200 |
42083012 |
Scut82 |
C |
Aug. 25, 2018, 9:14 a.m. |
OK |
GNU C++ |
TESTS |
121 |
156 |
26419200 |
|
2200 |
42116447 |
Scut82 |
C |
Aug. 26, 2018, 10:02 a.m. |
OK |
GNU C++ |
TESTS |
121 |
171 |
27238400 |
|
2200 |
59871194 |
rainboy |
C |
Sept. 1, 2019, 7:29 p.m. |
OK |
GNU C11 |
TESTS |
121 |
670 |
23961600 |
|
2200 |
68427812 |
zhanyi_xiaolu |
C |
Jan. 9, 2020, 5:02 a.m. |
OK |
GNU C++11 |
TESTS |
121 |
62 |
58470400 |
|
2200 |
46437495 |
luogu_bot1 |
C |
Dec. 1, 2018, 10:05 a.m. |
OK |
GNU C++11 |
TESTS |
121 |
77 |
58470400 |
|
2200 |
45371149 |
luogu_bot3 |
C |
Nov. 6, 2018, 9:51 a.m. |
OK |
GNU C++11 |
TESTS |
121 |
78 |
15564800 |
|
2200 |
45371162 |
fengxunling |
C |
Nov. 6, 2018, 9:51 a.m. |
OK |
GNU C++11 |
TESTS |
121 |
78 |
15564800 |
|
2200 |
51166193 |
luogu_bot4 |
C |
March 11, 2019, 2:22 p.m. |
OK |
GNU C++11 |
TESTS |
121 |
93 |
13209600 |
|
2200 |
64516362 |
shengzihang |
C |
Nov. 8, 2019, 10:52 a.m. |
OK |
GNU C++11 |
TESTS |
121 |
93 |
13516800 |
|
2200 |
45346009 |
ART_coder_ |
C |
Nov. 6, 2018, 3:09 a.m. |
OK |
GNU C++11 |
TESTS |
121 |
93 |
14540800 |
|
2200 |
46142065 |
luogu_bot1 |
C |
Nov. 24, 2018, 7:02 a.m. |
OK |
GNU C++11 |
TESTS |
121 |
93 |
15462400 |
|
2200 |
55323245 |
mrclr |
C |
June 9, 2019, 6:23 a.m. |
OK |
GNU C++11 |
TESTS |
121 |
93 |
15462400 |
|
2200 |
56868097 |
luogu_bot2 |
C |
July 12, 2019, 4:44 a.m. |
OK |
GNU C++11 |
TESTS |
121 |
93 |
16691200 |
|
2200 |
50071497 |
Mlxa |
C |
Feb. 17, 2019, 6 p.m. |
OK |
GNU C++14 |
TESTS |
121 |
186 |
30617600 |
|
2200 |
50071288 |
Mlxa |
C |
Feb. 17, 2019, 5:53 p.m. |
OK |
GNU C++14 |
TESTS |
121 |
202 |
28569600 |
|
2200 |
50071348 |
Mlxa |
C |
Feb. 17, 2019, 5:55 p.m. |
OK |
GNU C++14 |
TESTS |
121 |
202 |
30617600 |
|
2200 |
49031810 |
wleung_bvg |
C |
Jan. 26, 2019, 11:08 p.m. |
OK |
GNU C++14 |
TESTS |
121 |
217 |
26214400 |
|
2200 |
44771523 |
Reventon |
C |
Oct. 24, 2018, 12:35 p.m. |
OK |
GNU C++14 |
TESTS |
121 |
295 |
22118400 |
|
2200 |
51141532 |
Underdog_eagle |
C |
March 10, 2019, 7:36 p.m. |
OK |
GNU C++14 |
TESTS |
121 |
296 |
20992000 |
|
2200 |
54405828 |
blacklogic |
C |
May 20, 2019, 6:09 a.m. |
OK |
GNU C++14 |
TESTS |
121 |
296 |
26931200 |
|
2200 |
46854243 |
silversRayleigh |
C |
Dec. 10, 2018, 1:52 p.m. |
OK |
GNU C++14 |
TESTS |
121 |
296 |
31846400 |
|
2200 |
51141668 |
Underdog_eagle |
C |
March 10, 2019, 7:42 p.m. |
OK |
GNU C++14 |
TESTS |
121 |
311 |
20992000 |
|
2200 |
40366031 |
vjudge1 |
C |
July 15, 2018, 5:51 a.m. |
OK |
GNU C++14 |
TESTS |
121 |
311 |
22835200 |
|
2200 |
41576228 |
vjudge5 |
C |
Aug. 14, 2018, 5:03 a.m. |
OK |
GNU C++17 |
TESTS |
121 |
109 |
26419200 |
|
2200 |
51075348 |
nimphy |
C |
March 9, 2019, 9:11 a.m. |
OK |
GNU C++17 |
TESTS |
121 |
295 |
57651200 |
|
2200 |
41089818 |
reej |
C |
Aug. 1, 2018, 4 p.m. |
OK |
GNU C++17 |
TESTS |
121 |
296 |
30208000 |
|
2200 |
51167711 |
flwfdd |
C |
March 11, 2019, 2:58 p.m. |
OK |
GNU C++17 |
TESTS |
121 |
296 |
30617600 |
|
2200 |
48050136 |
2ooWeak2ooSlow2ooDumb |
C |
Jan. 7, 2019, 8:15 a.m. |
OK |
GNU C++17 |
TESTS |
121 |
296 |
33792000 |
|
2200 |
53295943 |
vjudge2 |
C |
April 25, 2019, 5:35 p.m. |
OK |
GNU C++17 |
TESTS |
121 |
296 |
57651200 |
|
2200 |
58531542 |
vjudge4 |
C |
Aug. 10, 2019, 9:45 a.m. |
OK |
GNU C++17 |
TESTS |
121 |
311 |
22835200 |
|
2200 |
58822002 |
Error_404 |
C |
Aug. 14, 2019, 2:24 p.m. |
OK |
GNU C++17 |
TESTS |
121 |
311 |
28057600 |
|
2200 |
61963535 |
erfanaskari1 |
C |
Oct. 6, 2019, 8:11 a.m. |
OK |
GNU C++17 |
TESTS |
121 |
311 |
29286400 |
|
2200 |
59387181 |
SMani24 |
C |
Aug. 24, 2019, 6:55 a.m. |
OK |
GNU C++17 |
TESTS |
121 |
311 |
29286400 |
|
2200 |
34493018 |
vjudge4 |
C |
Jan. 23, 2018, 6:39 p.m. |
OK |
Go |
TESTS |
121 |
546 |
74137600 |
|
2200 |
34493036 |
vjudge1 |
C |
Jan. 23, 2018, 6:40 p.m. |
OK |
Go |
TESTS |
121 |
592 |
74342400 |
|
2200 |
34492832 |
megaspazz |
C |
Jan. 23, 2018, 6:32 p.m. |
OK |
Go |
TESTS |
121 |
639 |
83660800 |
|
2200 |
34492732 |
megaspazz |
C |
Jan. 23, 2018, 6:29 p.m. |
OK |
Go |
TESTS |
121 |
670 |
75571200 |
|
2200 |
59871242 |
Dukkha |
C |
Sept. 1, 2019, 7:30 p.m. |
OK |
Java 8 |
TESTS |
121 |
202 |
21401600 |
|
2200 |
49910320 |
Celesta |
C |
Feb. 14, 2019, 1:52 p.m. |
OK |
Java 8 |
TESTS |
121 |
343 |
53555200 |
|
2200 |
39239915 |
Ahmad |
C |
June 14, 2018, 10:26 a.m. |
OK |
Java 8 |
TESTS |
121 |
374 |
23244800 |
|
2200 |
64710278 |
kashishsingh8700 |
C |
Nov. 11, 2019, 6:20 p.m. |
OK |
Java 8 |
TESTS |
121 |
467 |
70144000 |
|
2200 |
48577723 |
ShowStopper728 |
C |
Jan. 19, 2019, 2:57 p.m. |
OK |
Java 8 |
TESTS |
121 |
483 |
70144000 |
|
2200 |
49031883 |
AQT |
C |
Jan. 26, 2019, 11:14 p.m. |
OK |
Java 8 |
TESTS |
121 |
498 |
41574400 |
|
2200 |
40100422 |
tsumit023 |
C |
July 9, 2018, 4:39 a.m. |
OK |
Java 8 |
TESTS |
121 |
560 |
66150400 |
|
2200 |
41984560 |
supergoa |
C |
Aug. 23, 2018, 5:07 a.m. |
OK |
Java 8 |
TESTS |
121 |
561 |
51609600 |
|
2200 |
38548601 |
AQT |
C |
May 23, 2018, 12:56 a.m. |
OK |
Java 8 |
TESTS |
121 |
577 |
41574400 |
|
2200 |
45053365 |
guptautkarsh028 |
C |
Oct. 29, 2018, 11:41 a.m. |
OK |
Java 8 |
TESTS |
121 |
623 |
152576000 |
|
2200 |
57500288 |
vjudge3 |
C |
July 22, 2019, 9:53 a.m. |
OK |
MS C++ |
TESTS |
121 |
312 |
73318400 |
|
2200 |
56837699 |
vjudge4 |
C |
July 11, 2019, 9:55 a.m. |
OK |
MS C++ |
TESTS |
121 |
421 |
24064000 |
|
2200 |
62096629 |
vjudge4 |
C |
Oct. 8, 2019, 7:46 a.m. |
OK |
MS C++ |
TESTS |
121 |
514 |
38604800 |
|
2200 |
58136902 |
yorky |
C |
Aug. 1, 2019, 4:29 p.m. |
OK |
MS C++ 2017 |
TESTS |
121 |
997 |
42086400 |
|
2200 |
remove filters
Back to search problems