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 must have heard of the two brothers dreaming of ruling the world. With all their previous plans failed, this time they decided to cooperate with each other in order to rule the world. As you know there are n countries in the world. These countries are connected by n xe2 x80 x89- xe2 x80 x891 directed roads. If you don't consider direction of the roads there is a unique path between every pair of countries in the world, passing through each road at most once. Each of the brothers wants to establish his reign in some country, then it's possible for him to control the countries that can be reached from his country using directed roads. The brothers can rule the world if there exists at most two countries for brothers to choose (and establish their reign in these countries) so that any other country is under control of at least one of them. In order to make this possible they want to change the direction of minimum number of roads. Your task is to calculate this minimum number of roads. The first line of input contains an integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x893000). Each of the next n xe2 x80 x89- xe2 x80 x891 lines contains two space-separated integers ai and bi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai, xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n; ai xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89bi) saying there is a road from country ai to country bi. Consider that countries are numbered from 1 to n. It's guaranteed that if you don't consider direction of the roads there is a unique path between every pair of countries in the world, passing through each road at most once. In the only line of output print the minimum number of roads that their direction should be changed so that the brothers will be able to rule the world."... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
2560873 |
Depool |
C |
Nov. 14, 2012, 9:30 p.m. |
OK |
Delphi |
TESTS |
43 |
781 |
72192000 |
|
2200 |
2514432 |
AleksanderBalobanov |
C |
Nov. 6, 2012, 11:36 a.m. |
OK |
Delphi |
TESTS |
43 |
1000 |
72294400 |
|
2200 |
14780122 |
SilverDH |
C |
Dec. 13, 2015, 3:51 a.m. |
OK |
FPC |
TESTS |
43 |
342 |
307200 |
|
2200 |
2533070 |
nhandi |
C |
Nov. 11, 2012, 11:14 a.m. |
OK |
FPC |
TESTS |
43 |
468 |
307200 |
|
2200 |
2510233 |
hung06061995 |
C |
Nov. 5, 2012, 9:58 a.m. |
OK |
FPC |
TESTS |
43 |
640 |
307200 |
|
2200 |
34938259 |
lukomskiy |
C |
Feb. 5, 2018, 8:35 a.m. |
OK |
FPC |
TESTS |
43 |
654 |
202137600 |
|
2200 |
2900579 |
Furko |
C |
Jan. 9, 2013, 9:22 p.m. |
OK |
FPC |
TESTS |
43 |
859 |
819200 |
|
2200 |
2510837 |
ATM_oTTo |
C |
Nov. 5, 2012, 12:35 p.m. |
OK |
FPC |
TESTS |
43 |
875 |
307200 |
|
2200 |
2805101 |
vubinh |
C |
Dec. 22, 2012, 1:55 a.m. |
OK |
FPC |
TESTS |
43 |
875 |
18329600 |
|
2200 |
2532242 |
Yaroslav-555 |
C |
Nov. 11, 2012, 7:12 a.m. |
OK |
FPC |
TESTS |
43 |
906 |
307200 |
|
2200 |
2512966 |
darkmaycry |
C |
Nov. 6, 2012, 2:07 a.m. |
OK |
FPC |
TESTS |
43 |
906 |
307200 |
|
2200 |
2509135 |
con_nha_ngheo |
C |
Nov. 5, 2012, 4:08 a.m. |
OK |
FPC |
TESTS |
43 |
906 |
409600 |
|
2200 |
12274522 |
akashdeep |
C |
July 30, 2015, 11:15 a.m. |
OK |
GNU C++ |
TESTS |
43 |
30 |
512000 |
|
2200 |
21512965 |
Worldwide_D |
C |
Oct. 17, 2016, 7:02 a.m. |
OK |
GNU C++ |
TESTS |
43 |
30 |
7987200 |
|
2200 |
2556273 |
FattyChicken |
C |
Nov. 14, 2012, 10:46 a.m. |
OK |
GNU C++ |
TESTS |
43 |
31 |
512000 |
|
2200 |
2501221 |
White_Bear |
C |
Nov. 4, 2012, 4:40 p.m. |
OK |
GNU C++ |
TESTS |
43 |
31 |
614400 |
|
2200 |
2504535 |
kennethsnow |
C |
Nov. 4, 2012, 5:56 p.m. |
OK |
GNU C++ |
TESTS |
43 |
31 |
4096000 |
|
2200 |
2513413 |
liympanda |
C |
Nov. 6, 2012, 6:35 a.m. |
OK |
GNU C++ |
TESTS |
43 |
46 |
307200 |
|
2200 |
2533511 |
imbanoob |
C |
Nov. 11, 2012, 1:48 p.m. |
OK |
GNU C++ |
TESTS |
43 |
46 |
614400 |
|
2200 |
2515645 |
daidailanlan |
C |
Nov. 6, 2012, 4:27 p.m. |
OK |
GNU C++ |
TESTS |
43 |
46 |
819200 |
|
2200 |
2501181 |
PavelKunyavskiy |
C |
Nov. 4, 2012, 4:39 p.m. |
OK |
GNU C++ |
TESTS |
43 |
46 |
1331200 |
|
2200 |
2506757 |
kennethsnow |
C |
Nov. 4, 2012, 7:21 p.m. |
OK |
GNU C++ |
TESTS |
43 |
46 |
3993600 |
|
2200 |
4360088 |
vjudge5 |
C |
Aug. 28, 2013, 5:42 a.m. |
OK |
GNU C++0x |
TESTS |
43 |
156 |
118067200 |
|
2200 |
2503952 |
Ilya_MSU |
C |
Nov. 4, 2012, 5:43 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
187 |
409600 |
|
2200 |
5198306 |
2011330300713 |
C |
Nov. 23, 2013, 1:41 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
218 |
204800 |
|
2200 |
10234404 |
a654889339 |
C |
March 11, 2015, 8:12 a.m. |
OK |
GNU C++0x |
TESTS |
43 |
248 |
4096000 |
|
2200 |
2683345 |
Xerxes |
C |
Dec. 1, 2012, 10:41 a.m. |
OK |
GNU C++0x |
TESTS |
43 |
250 |
614400 |
|
2200 |
2504981 |
pablo.aguilar |
C |
Nov. 4, 2012, 6:34 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
250 |
1126400 |
|
2200 |
2515326 |
BSBandme |
C |
Nov. 6, 2012, 2:56 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
265 |
307200 |
|
2200 |
3564275 |
diego_v1 |
C |
April 19, 2013, 1:13 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
265 |
512000 |
|
2200 |
3564213 |
diego_v1 |
C |
April 19, 2013, 1:01 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
265 |
512000 |
|
2200 |
7316324 |
aliasadiiii |
C |
Aug. 1, 2014, 4:41 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
312 |
409600 |
|
2200 |
26653094 |
I_always_love_cc |
C |
April 25, 2017, 5:04 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
30 |
2560000 |
|
2200 |
16402319 |
ACErupt |
C |
Feb. 28, 2016, 11:48 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
248 |
204800 |
|
2200 |
54998652 |
SoiMae |
C |
June 3, 2019, 2:32 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
248 |
307200 |
|
2200 |
14303521 |
Shayan |
C |
Nov. 16, 2015, 8:11 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
248 |
307200 |
|
2200 |
28728722 |
Ehsan22 |
C |
July 20, 2017, 3:38 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
278 |
2355200 |
|
2200 |
44375241 |
4l5n3 |
C |
Oct. 15, 2018, 8:53 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
278 |
3788800 |
|
2200 |
60733996 |
sorry_im_smurfing |
C |
Sept. 17, 2019, 4:46 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
280 |
307200 |
|
2200 |
57898764 |
lopare |
C |
July 28, 2019, 2:45 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
280 |
307200 |
|
2200 |
14423447 |
vjudge5 |
C |
Nov. 23, 2015, 8:52 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
280 |
307200 |
|
2200 |
14302931 |
Shayan |
C |
Nov. 16, 2015, 7:14 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
280 |
307200 |
|
2200 |
30648800 |
Minnakhmetov |
C |
Sept. 23, 2017, 4:44 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
218 |
409600 |
|
2200 |
34939196 |
.Vanya |
C |
Feb. 5, 2018, 9:14 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
248 |
3481600 |
|
2200 |
42020726 |
vjudge2 |
C |
Aug. 24, 2018, 8:59 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
280 |
512000 |
|
2200 |
34946486 |
AStarantsov |
C |
Feb. 5, 2018, 2:15 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
280 |
2252800 |
|
2200 |
31442837 |
chemthan |
C |
Oct. 17, 2017, 9:04 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
280 |
2355200 |
|
2200 |
22645913 |
AryanSM |
C |
Dec. 1, 2016, 6:05 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
280 |
4403200 |
|
2200 |
55090968 |
vjudge5 |
C |
June 4, 2019, 2:31 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
312 |
409600 |
|
2200 |
46454152 |
bluefi |
C |
Dec. 1, 2018, 5:22 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
312 |
512000 |
|
2200 |
42020670 |
Dibagger |
C |
Aug. 24, 2018, 8:57 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
312 |
512000 |
|
2200 |
41153077 |
MAMBA |
C |
Aug. 3, 2018, 10:10 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
312 |
512000 |
|
2200 |
38957515 |
alidadar7676 |
C |
June 5, 2018, 2:02 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
278 |
4915200 |
|
2200 |
57978851 |
Compiled |
C |
July 30, 2019, 8:37 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
280 |
4198400 |
|
2200 |
61313042 |
vjudge2 |
C |
Sept. 26, 2019, 10 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
310 |
4403200 |
|
2200 |
56413579 |
llmxby |
C |
July 2, 2019, 2:40 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
312 |
409600 |
|
2200 |
60311242 |
aryanv |
C |
Sept. 9, 2019, 3:55 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
312 |
4403200 |
|
2200 |
42705856 |
vjudge3 |
C |
Sept. 9, 2018, 1:11 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
342 |
512000 |
|
2200 |
60839012 |
vjudge3 |
C |
Sept. 19, 2019, 10:11 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
404 |
512000 |
|
2200 |
42696303 |
vjudge1 |
C |
Sept. 9, 2018, 7:24 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
466 |
614400 |
|
2200 |
50606686 |
ruo |
C |
Feb. 28, 2019, 2:52 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
468 |
512000 |
|
2200 |
55086653 |
vjudge3 |
C |
June 4, 2019, 12:49 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
498 |
512000 |
|
2200 |
2504739 |
ysyshtc |
C |
Nov. 4, 2012, 5:59 p.m. |
OK |
Java 6 |
TESTS |
43 |
156 |
512000 |
|
2200 |
2504376 |
uwi |
C |
Nov. 4, 2012, 5:53 p.m. |
OK |
Java 6 |
TESTS |
43 |
734 |
144588800 |
|
2200 |
2505120 |
uwi |
C |
Nov. 4, 2012, 6:41 p.m. |
OK |
Java 6 |
TESTS |
43 |
828 |
0 |
|
2200 |
4335188 |
hama-du |
C |
Aug. 25, 2013, 8:41 a.m. |
OK |
Java 6 |
TESTS |
43 |
1060 |
204800 |
|
2200 |
2508548 |
Kornacker |
C |
Nov. 4, 2012, 11:01 p.m. |
OK |
Java 6 |
TESTS |
43 |
1078 |
139776000 |
|
2200 |
2587306 |
ftiasch |
C |
Nov. 19, 2012, 7:01 a.m. |
OK |
Java 6 |
TESTS |
43 |
1218 |
204800 |
|
2200 |
2584514 |
hs484 |
C |
Nov. 18, 2012, 10:37 a.m. |
OK |
Java 6 |
TESTS |
43 |
1500 |
204800 |
|
2200 |
3722239 |
santjuan |
C |
May 15, 2013, 4:17 a.m. |
OK |
Java 7 |
TESTS |
43 |
109 |
307200 |
|
2200 |
8459664 |
PlayLikeNeverB4 |
C |
Oct. 28, 2014, 5 p.m. |
OK |
Java 7 |
TESTS |
43 |
186 |
409600 |
|
2200 |
2504644 |
S.Yesipenko |
C |
Nov. 4, 2012, 5:58 p.m. |
OK |
Java 7 |
TESTS |
43 |
625 |
102400 |
|
2200 |
2505170 |
Jokser |
C |
Nov. 4, 2012, 6:47 p.m. |
OK |
Java 7 |
TESTS |
43 |
656 |
52531200 |
|
2200 |
2502239 |
cerealguy |
C |
Nov. 4, 2012, 5:02 p.m. |
OK |
Java 7 |
TESTS |
43 |
906 |
0 |
|
2200 |
2508384 |
mmaxio |
C |
Nov. 4, 2012, 9:03 p.m. |
OK |
Java 7 |
TESTS |
43 |
1156 |
102400 |
|
2200 |
2503006 |
qwerty787788 |
C |
Nov. 4, 2012, 5:20 p.m. |
OK |
Java 7 |
TESTS |
43 |
1218 |
204800 |
|
2200 |
2504146 |
mmaxio |
C |
Nov. 4, 2012, 5:47 p.m. |
OK |
Java 7 |
TESTS |
43 |
1281 |
102400 |
|
2200 |
2519800 |
FattyPenguin |
C |
Nov. 7, 2012, 2:49 p.m. |
OK |
Java 7 |
TESTS |
43 |
1406 |
0 |
|
2200 |
10226368 |
a654889339 |
C |
March 10, 2015, 12:37 p.m. |
OK |
Java 7 |
TESTS |
43 |
1466 |
0 |
|
2200 |
7610607 |
AlexFetisov |
C |
Aug. 28, 2014, 4:32 a.m. |
OK |
Java 8 |
TESTS |
43 |
1214 |
3788800 |
|
2200 |
10226899 |
vjudge5 |
C |
March 10, 2015, 1:29 p.m. |
OK |
Java 8 |
TESTS |
43 |
1558 |
0 |
|
2200 |
2503178 |
Shef |
C |
Nov. 4, 2012, 5:24 p.m. |
OK |
MS C++ |
TESTS |
43 |
46 |
614400 |
|
2200 |
2512641 |
tomas.svab |
C |
Nov. 5, 2012, 8:33 p.m. |
OK |
MS C++ |
TESTS |
43 |
312 |
307200 |
|
2200 |
3142580 |
RAD |
C |
Feb. 18, 2013, 9:10 a.m. |
OK |
MS C++ |
TESTS |
43 |
343 |
307200 |
|
2200 |
2514400 |
poopi |
C |
Nov. 6, 2012, 11:29 a.m. |
OK |
MS C++ |
TESTS |
43 |
359 |
307200 |
|
2200 |
9195037 |
Alex7 |
C |
Dec. 19, 2014, 9:28 a.m. |
OK |
MS C++ |
TESTS |
43 |
404 |
409600 |
|
2200 |
2528215 |
564ht |
C |
Nov. 9, 2012, 4:55 p.m. |
OK |
MS C++ |
TESTS |
43 |
406 |
204800 |
|
2200 |
2502178 |
al13n |
C |
Nov. 4, 2012, 5:01 p.m. |
OK |
MS C++ |
TESTS |
43 |
406 |
307200 |
|
2200 |
2508075 |
mugurelionut |
C |
Nov. 4, 2012, 7:41 p.m. |
OK |
MS C++ |
TESTS |
43 |
421 |
204800 |
|
2200 |
2519605 |
Beetl |
C |
Nov. 7, 2012, 1:56 p.m. |
OK |
MS C++ |
TESTS |
43 |
421 |
9318400 |
|
2200 |
2503865 |
KuchumovIlya |
C |
Nov. 4, 2012, 5:41 p.m. |
OK |
MS C++ |
TESTS |
43 |
453 |
307200 |
|
2200 |
remove filters
Back to search problems