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'Three planets X , Y and Z within the Alpha planetary system are inhabited with an advanced civilization. The spaceports of these planets are connected by interplanetary space shuttles. The flight scheduler should decide between 1 , 2 and 3 return flights for every existing space shuttle connection. Since the residents of Alpha are strong opponents of the symmetry, there is a strict rule that any two of the spaceports connected by a shuttle must have a different number of flights. For every pair of connected spaceports, your goal is to propose a number 1 , 2 or 3 for each shuttle flight, so that for every two connected spaceports the overall number of flights differs. You may assume that: 1) Every planet has at least one spaceport 2) There exist only shuttle flights between spaceports of different planets 3) For every two spaceports there is a series of shuttle flights enabling traveling between them 4) Spaceports are not connected by more than one shuttle The first row of the input is the integer number N (3 <= q N <= q 100 000) , representing overall number of spaceports. The second row is the integer number M (2 <= q M <= q 100 000) representing number of shuttle flight connections. Third row contains N characters from the set {X, Y, Z } . Letter on I^{th} position indicates on which planet is situated spaceport I . For example, "XYYXZZ" indicates that the spaceports 0 and 3 are located at planet X , spaceports 1 and 2 are located at Y , and spaceports 4 and 5 are at Z . Starting from the fourth row, every row contains two integer numbers separated by a whitespace. These numbers are natural numbers smaller than N and indicate the numbers of the spaceports that are connected. For example, " 12 15 " indicates that there is a shuttle flight between spaceports 12 and 15 . The same rep'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
60950810 |
TankEngineer |
G |
Sept. 20, 2019, 9:38 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
78 |
13926400 |
|
3300 |
60820421 |
krijgertje |
G |
Sept. 18, 2019, 11:35 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
93 |
11980800 |
|
3300 |
60819159 |
krijgertje |
G |
Sept. 18, 2019, 10:24 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
93 |
11980800 |
|
3300 |
60877583 |
DmitryGrigorev |
G |
Sept. 19, 2019, 3:46 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
93 |
13414400 |
|
3300 |
61025898 |
ShadowLight |
G |
Sept. 21, 2019, 3:59 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
108 |
13414400 |
|
3300 |
60671677 |
abeker |
G |
Sept. 16, 2019, 10:56 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
108 |
19456000 |
|
3300 |
60646913 |
300iq MiFaFaOvO |
G |
Sept. 15, 2019, 5:30 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
124 |
13926400 |
|
3300 |
61827452 |
Xpart_Hacker |
G |
Oct. 4, 2019, 5:23 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
93 |
13619200 |
|
3300 |
60649545 |
KAN Um_nik |
G |
Sept. 15, 2019, 6:33 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
108 |
11980800 |
|
3300 |
60685150 |
hieudaica |
G |
Sept. 16, 2019, 3:09 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
108 |
13619200 |
|
3300 |
60682762 |
ivan100sic |
G |
Sept. 16, 2019, 2:27 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
108 |
13619200 |
|
3300 |
60646045 |
Nebuchadnezzar kraborak cdkrot |
G |
Sept. 15, 2019, 5:11 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
109 |
14643200 |
|
3300 |
66431555 |
gongsuidashen |
G |
Dec. 7, 2019, 3:18 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
124 |
13721600 |
|
3300 |
60694867 |
Benq |
G |
Sept. 16, 2019, 7:06 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
124 |
25600000 |
|
3300 |
60697479 |
ReD_AwHiLe |
G |
Sept. 16, 2019, 8:30 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
187 |
20480000 |
|
3300 |
remove filters
Back to search problems