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"Bertown has n junctions and m bidirectional roads. We know that one can get from any junction to any other one by the existing roads. As there were more and more cars in the city, traffic jams started to pose real problems. To deal with them the government decided to make the traffic one-directional on all the roads, thus easing down the traffic. Your task is to determine whether there is a way to make the traffic one-directional so that there still is the possibility to get from any junction to any other one. If the answer is positive, you should also find one of the possible ways to orient the roads. The first line contains two space-separated integers n and m (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105, xe2 x80 x89n xe2 x80 x89- xe2 x80 x891 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x893 xc2 xb7105) which represent the number of junctions and the roads in the town correspondingly. Then follow m lines, each containing two numbers which describe the roads in the city. Each road is determined by two 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, xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89bi) -- the numbers of junctions it connects. It is guaranteed that one can get from any junction to any other one along the existing bidirectional roads. Each road connects different junctions, there is no more than one road between each pair of junctions. If there's no solution, print the single number 0. Otherwise, print m lines each containing two integers pi and qi -- each road's orientation. That is the traffic flow will move along a one-directional road from junction pi to junction qi. You can print the roads in any order. If there are several solutions to that problem, print any of them."... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
59111344 |
rainboy |
E |
Aug. 19, 2019, 9 p.m. |
OK |
GNU C11 |
TESTS |
144 |
2402 |
13209600 |
|
2100 |
52081242 |
vjudge3 |
E |
March 31, 2019, 12:16 p.m. |
OK |
GNU C++11 |
TESTS |
144 |
342 |
10342400 |
|
2100 |
52081201 |
XY_cpp |
E |
March 31, 2019, 12:15 p.m. |
OK |
GNU C++11 |
TESTS |
144 |
372 |
10342400 |
|
2100 |
49049311 |
nhho |
E |
Jan. 27, 2019, 10:17 a.m. |
OK |
GNU C++11 |
TESTS |
144 |
498 |
16486400 |
|
2100 |
48548891 |
Tanmoy_Datta |
E |
Jan. 18, 2019, 10:39 p.m. |
OK |
GNU C++11 |
TESTS |
144 |
498 |
20275200 |
|
2100 |
57903989 |
lopare |
E |
July 28, 2019, 4:51 p.m. |
OK |
GNU C++11 |
TESTS |
144 |
528 |
19968000 |
|
2100 |
48548983 |
Tanmoy_Datta |
E |
Jan. 18, 2019, 10:48 p.m. |
OK |
GNU C++11 |
TESTS |
144 |
528 |
20070400 |
|
2100 |
50892340 |
a2dalek |
E |
March 6, 2019, 1:38 p.m. |
OK |
GNU C++11 |
TESTS |
144 |
560 |
24371200 |
|
2100 |
51158394 |
Sherek |
E |
March 11, 2019, 11:12 a.m. |
OK |
GNU C++11 |
TESTS |
144 |
590 |
14643200 |
|
2100 |
62174175 |
fuk |
E |
Oct. 9, 2019, 3:04 a.m. |
OK |
GNU C++11 |
TESTS |
144 |
1184 |
15257600 |
|
2100 |
57115842 |
gote |
E |
July 15, 2019, 8:04 p.m. |
OK |
GNU C++11 |
TESTS |
144 |
1184 |
18022400 |
|
2100 |
52490318 |
Cwolf9.0 |
E |
April 8, 2019, 11:20 a.m. |
OK |
GNU C++14 |
TESTS |
144 |
498 |
75366400 |
|
2100 |
58428591 |
rightways |
E |
Aug. 7, 2019, 10:52 a.m. |
OK |
GNU C++14 |
TESTS |
144 |
560 |
18739200 |
|
2100 |
56017911 |
sorry_im_smurfing |
E |
June 24, 2019, 11:17 p.m. |
OK |
GNU C++14 |
TESTS |
144 |
560 |
20070400 |
|
2100 |
66794520 |
_HossamYehia_ |
E |
Dec. 13, 2019, 4:31 p.m. |
OK |
GNU C++14 |
TESTS |
144 |
560 |
30412800 |
|
2100 |
67511833 |
madlad |
E |
Dec. 24, 2019, 9:26 a.m. |
OK |
GNU C++14 |
TESTS |
144 |
590 |
20275200 |
|
2100 |
48304064 |
NullByte |
E |
Jan. 12, 2019, 6:36 p.m. |
OK |
GNU C++14 |
TESTS |
144 |
590 |
24985600 |
|
2100 |
59820606 |
CaroLinda |
E |
Aug. 31, 2019, 5:11 p.m. |
OK |
GNU C++14 |
TESTS |
144 |
592 |
19251200 |
|
2100 |
62386258 |
zeus_iitg |
E |
Oct. 11, 2019, 9:34 p.m. |
OK |
GNU C++14 |
TESTS |
144 |
592 |
20275200 |
|
2100 |
50566554 |
sliman00 |
E |
Feb. 27, 2019, 1:24 p.m. |
OK |
GNU C++14 |
TESTS |
144 |
592 |
24473600 |
|
2100 |
59680820 |
bhaag_milkha |
E |
Aug. 29, 2019, 8:30 p.m. |
OK |
GNU C++14 |
TESTS |
144 |
592 |
27750400 |
|
2100 |
55713946 |
ILLLZKQF |
E |
June 18, 2019, 11:44 a.m. |
OK |
GNU C++17 |
TESTS |
144 |
466 |
30822400 |
|
2100 |
48199970 |
abraham14 |
E |
Jan. 11, 2019, 4:39 a.m. |
OK |
GNU C++17 |
TESTS |
144 |
560 |
17305600 |
|
2100 |
67663044 |
Mahdi_Shokoufi |
E |
Dec. 26, 2019, 4:40 p.m. |
OK |
GNU C++17 |
TESTS |
144 |
560 |
20582400 |
|
2100 |
49885306 |
darkkcyan |
E |
Feb. 13, 2019, 8:46 p.m. |
OK |
GNU C++17 |
TESTS |
144 |
590 |
18739200 |
|
2100 |
54784051 |
vjudge2 |
E |
May 29, 2019, 2:04 a.m. |
OK |
GNU C++17 |
TESTS |
144 |
590 |
23040000 |
|
2100 |
69519330 |
SuiT_Up |
E |
Jan. 25, 2020, 12:58 p.m. |
OK |
GNU C++17 |
TESTS |
144 |
590 |
24473600 |
|
2100 |
51903319 |
thocevar |
E |
March 27, 2019, 2:21 p.m. |
OK |
GNU C++17 |
TESTS |
144 |
592 |
18534400 |
|
2100 |
67676035 |
errorgorn |
E |
Dec. 27, 2019, 1:52 a.m. |
OK |
GNU C++17 |
TESTS |
144 |
592 |
18739200 |
|
2100 |
69519272 |
SuiT_Up |
E |
Jan. 25, 2020, 12:57 p.m. |
OK |
GNU C++17 |
TESTS |
144 |
592 |
19456000 |
|
2100 |
68018132 |
Arkham_Knight |
E |
Dec. 31, 2019, 8:07 p.m. |
OK |
GNU C++17 |
TESTS |
144 |
592 |
19660800 |
|
2100 |
69230410 |
GiantTornado |
E |
Jan. 21, 2020, 9:14 a.m. |
OK |
Java 11 |
TESTS |
144 |
2900 |
148480000 |
|
2100 |
56748676 |
7dan |
E |
July 9, 2019, 11 a.m. |
OK |
Java 8 |
TESTS |
144 |
966 |
45158400 |
|
2100 |
66082201 |
guptautkarsh028 |
E |
Dec. 1, 2019, 1:08 a.m. |
OK |
Java 8 |
TESTS |
144 |
1184 |
80588800 |
|
2100 |
62974107 |
shu37052 |
E |
Oct. 20, 2019, 7:58 a.m. |
OK |
Java 8 |
TESTS |
144 |
1434 |
62156800 |
|
2100 |
66515198 |
ijxjdjd |
E |
Dec. 8, 2019, 6:32 p.m. |
OK |
Java 8 |
TESTS |
144 |
1496 |
63385600 |
|
2100 |
70012078 |
vjudge1 |
E |
Feb. 2, 2020, 7:10 a.m. |
OK |
Java 8 |
TESTS |
144 |
1622 |
58880000 |
|
2100 |
59111343 |
Dukkha |
E |
Aug. 19, 2019, 9 p.m. |
OK |
Java 8 |
TESTS |
144 |
1778 |
10240000 |
|
2100 |
51580847 |
GiantTornado |
E |
March 20, 2019, 2:26 p.m. |
OK |
Java 8 |
TESTS |
144 |
2058 |
87552000 |
|
2100 |
63193023 |
jdurie |
E |
Oct. 22, 2019, 5:44 p.m. |
OK |
Java 8 |
TESTS |
144 |
3368 |
182784000 |
|
2100 |
53581842 |
supriya14 |
E |
April 30, 2019, 4:05 p.m. |
OK |
Java 8 |
TESTS |
144 |
4990 |
31334400 |
|
2100 |
53581453 |
supriya14 |
E |
April 30, 2019, 3:55 p.m. |
OK |
Java 8 |
TESTS |
144 |
4990 |
31334400 |
|
2100 |
remove filters
Back to search problems