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"Ivan is a novice painter. He has n dyes of different colors. He also knows exactly m pairs of colors which harmonize with each other. Ivan also enjoy playing chess. He has 5000 rooks. He wants to take k rooks, paint each of them in one of n colors and then place this k rooks on a chessboard of size 10^{9} x 10^{9} . Let's call the set of rooks on the board connected if from any rook we can get to any other rook in this set moving only through cells with rooks from this set. Assume that rooks can jump over other rooks, in other words a rook can go to any cell which shares vertical and to any cell which shares horizontal. Ivan wants his arrangement of rooks to have following properties: Please help Ivan find such an arrangement. The first line of input contains 2 integers n , m ( 1 <= n <= 100 , 0 <= m <= min(1000, , , frac{n(n-1)}{2}) ) -- number of colors and number of pairs of colors which harmonize with each other. In next m lines pairs of colors which harmonize with each other are listed. Colors are numbered from 1 to n . It is guaranteed that no pair occurs twice in this list. Print n blocks, i -th of them describes rooks of i -th color. In the first line of block print one number a_{i} ( 1 <= a_{i} <= 5000 ) -- number of rooks of color i . In each of next a_{i} lines print two integers x and y ( 1 <= x, , , y <= 10^{9} ) -- coordinates of the next rook. All rooks must be on different cells. Total number of rooks must not exceed 5000 . It is guaranteed that the solution exists. Rooks arrangements for all three examples (red is color 1 , green is color 2 and blue is color 3 ). "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
44818352 |
Denor |
C |
Oct. 24, 2018, 11:22 p.m. |
OK |
Delphi |
TESTS |
25 |
30 |
4300800 |
|
1700 |
44843233 |
cbl_nhathuy |
C |
Oct. 25, 2018, 1:32 p.m. |
OK |
FPC |
TESTS |
25 |
31 |
102400 |
|
1700 |
44803903 |
ilya_kas |
C |
Oct. 24, 2018, 5:56 p.m. |
OK |
FPC |
TESTS |
25 |
31 |
102400 |
|
1700 |
44801673 |
ruban |
C |
Oct. 24, 2018, 5:45 p.m. |
OK |
FPC |
TESTS |
25 |
31 |
178073600 |
|
1700 |
45755725 |
vjudge1 |
C |
Nov. 15, 2018, 5:41 a.m. |
OK |
GNU C11 |
TESTS |
25 |
31 |
3993600 |
|
1700 |
45755560 |
Jousero |
C |
Nov. 15, 2018, 5:34 a.m. |
OK |
GNU C11 |
TESTS |
25 |
31 |
3993600 |
|
1700 |
45755672 |
Jousero |
C |
Nov. 15, 2018, 5:38 a.m. |
OK |
GNU C11 |
TESTS |
25 |
31 |
3993600 |
|
1700 |
44828536 |
jaaguptamme |
C |
Oct. 25, 2018, 7:25 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
15 |
0 |
|
1700 |
48685347 |
w_t |
C |
Jan. 21, 2019, 3:01 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
15 |
0 |
|
1700 |
44821034 |
KUMAR_PRANJAL_RAI |
C |
Oct. 25, 2018, 2:22 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
15 |
102400 |
|
1700 |
67795967 |
vjudge2 |
C |
Dec. 28, 2019, 4:40 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
15 |
204800 |
|
1700 |
44810741 |
PGSStanislav |
C |
Oct. 24, 2018, 6:32 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
15 |
204800 |
|
1700 |
53836312 |
vjudge5 |
C |
May 7, 2019, 3:16 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
15 |
921600 |
|
1700 |
44890456 |
vjudge1 |
C |
Oct. 26, 2018, 2:54 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
15 |
4300800 |
|
1700 |
45308246 |
MasterLuke |
C |
Nov. 5, 2018, 12:11 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
30 |
0 |
|
1700 |
44934764 |
rcseven |
C |
Oct. 27, 2018, 4:39 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
30 |
0 |
|
1700 |
45310171 |
dummyummy |
C |
Nov. 5, 2018, 3:07 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
30 |
0 |
|
1700 |
44824081 |
emidrei |
C |
Oct. 25, 2018, 4:43 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
0 |
|
1700 |
44794425 |
dioji |
C |
Oct. 24, 2018, 5:16 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
102400 |
|
1700 |
50585700 |
TistPetr-is-ok |
C |
Feb. 28, 2019, 3:23 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
204800 |
|
1700 |
50295354 |
Oxygen. |
C |
Feb. 21, 2019, 8:01 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
204800 |
|
1700 |
46820591 |
OO0OO0OO0OO0 |
C |
Dec. 9, 2018, 3:02 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
204800 |
|
1700 |
46059447 |
passer__ |
C |
Nov. 22, 2018, 12:36 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
204800 |
|
1700 |
46058099 |
vjudge3 |
C |
Nov. 22, 2018, 11:58 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
204800 |
|
1700 |
57594766 |
Bhanu1219 |
C |
July 23, 2019, 1:33 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
204800 |
|
1700 |
57822008 |
Ahmed-Mostafa |
C |
July 27, 2019, 12:12 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
204800 |
|
1700 |
56048953 |
prasadpichku |
C |
June 25, 2019, 6:01 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
15 |
204800 |
|
1700 |
68077472 |
tester324 |
C |
Jan. 2, 2020, 1:08 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
0 |
|
1700 |
55420236 |
chongryong |
C |
June 11, 2019, 6 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
204800 |
|
1700 |
46347829 |
yintama |
C |
Nov. 28, 2018, 7:13 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
204800 |
|
1700 |
66731462 |
multimuvies |
C |
Dec. 12, 2019, 5:40 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
204800 |
|
1700 |
67973627 |
iit_ya_ism |
C |
Dec. 30, 2019, 3:59 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
204800 |
|
1700 |
50606773 |
fffeyn |
C |
Feb. 28, 2019, 2:55 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
204800 |
|
1700 |
59627183 |
valerikk |
C |
Aug. 28, 2019, 4:28 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
204800 |
|
1700 |
68153855 |
sjd0 |
C |
Jan. 4, 2020, 8:05 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
307200 |
|
1700 |
55470197 |
harshraj22 |
C |
June 11, 2019, 6:20 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
307200 |
|
1700 |
60316134 |
Extraordinary_ |
C |
Sept. 9, 2019, 6 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
15 |
409600 |
|
1700 |
44809421 |
4D5F525F47 |
C |
Oct. 24, 2018, 6:25 p.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
46922374 |
donli |
C |
Dec. 12, 2018, 6:02 a.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
51942655 |
mTvTm |
C |
March 28, 2019, 3:11 p.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
45281016 |
sweiss |
C |
Nov. 4, 2018, 1:46 p.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
44939401 |
vjvjain0 |
C |
Oct. 27, 2018, 7:03 a.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
44920530 |
Itwazonce |
C |
Oct. 26, 2018, 5:40 p.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
44828670 |
jenish9599 |
C |
Oct. 25, 2018, 7:29 a.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
44816472 |
bhautik_77 |
C |
Oct. 24, 2018, 9:43 p.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
44813907 |
parth_15 |
C |
Oct. 24, 2018, 8:28 p.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
44809757 |
ViciousCoder |
C |
Oct. 24, 2018, 6:27 p.m. |
OK |
Java 8 |
TESTS |
25 |
109 |
0 |
|
1700 |
54743301 |
Heltion |
C |
May 28, 2019, 9:11 a.m. |
OK |
Kotlin |
TESTS |
25 |
170 |
204800 |
|
1700 |
45247197 |
azukun |
C |
Nov. 3, 2018, 2:32 p.m. |
OK |
Mono C# |
TESTS |
25 |
61 |
2150400 |
|
1700 |
44804298 |
eki |
C |
Oct. 24, 2018, 5:58 p.m. |
OK |
Mono C# |
TESTS |
25 |
62 |
921600 |
|
1700 |
44841687 |
tattosha_aptan |
C |
Oct. 25, 2018, 12:59 p.m. |
OK |
Mono C# |
TESTS |
25 |
62 |
2355200 |
|
1700 |
44806067 |
Roverandom |
C |
Oct. 24, 2018, 6:08 p.m. |
OK |
Mono C# |
TESTS |
25 |
77 |
4096000 |
|
1700 |
44797339 |
omikad |
C |
Oct. 24, 2018, 5:27 p.m. |
OK |
Mono C# |
TESTS |
25 |
77 |
4096000 |
|
1700 |
53842134 |
vjudge5 |
C |
May 7, 2019, 8:14 a.m. |
OK |
MS C++ |
TESTS |
25 |
30 |
4096000 |
|
1700 |
45400910 |
vjudge1 |
C |
Nov. 7, 2018, 8:29 a.m. |
OK |
MS C++ |
TESTS |
25 |
31 |
0 |
|
1700 |
45088090 |
vjudge3 |
C |
Oct. 30, 2018, 8:23 a.m. |
OK |
MS C++ |
TESTS |
25 |
31 |
0 |
|
1700 |
44833496 |
CtrlAlt |
C |
Oct. 25, 2018, 9:41 a.m. |
OK |
MS C++ |
TESTS |
25 |
31 |
0 |
|
1700 |
44798455 |
youx |
C |
Oct. 24, 2018, 5:31 p.m. |
OK |
MS C++ |
TESTS |
25 |
31 |
0 |
|
1700 |
44804312 |
Captain_Hook |
C |
Oct. 24, 2018, 5:58 p.m. |
OK |
MS C++ |
TESTS |
25 |
31 |
102400 |
|
1700 |
44799649 |
Volpe |
C |
Oct. 24, 2018, 5:36 p.m. |
OK |
MS C++ |
TESTS |
25 |
31 |
102400 |
|
1700 |
45057175 |
vjudge5 |
C |
Oct. 29, 2018, 1:14 p.m. |
OK |
MS C++ |
TESTS |
25 |
31 |
102400 |
|
1700 |
44804333 |
Timonnable |
C |
Oct. 24, 2018, 5:59 p.m. |
OK |
MS C++ |
TESTS |
25 |
31 |
204800 |
|
1700 |
44793316 |
WHO_ARE_U |
C |
Oct. 24, 2018, 5:13 p.m. |
OK |
MS C++ |
TESTS |
25 |
31 |
204800 |
|
1700 |
59824343 |
Spiritum |
C |
Aug. 31, 2019, 6:44 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
31 |
0 |
|
1700 |
50779075 |
petko_mitkov |
C |
March 4, 2019, 10:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
31 |
102400 |
|
1700 |
44805931 |
mggtsnppr |
C |
Oct. 24, 2018, 6:07 p.m. |
OK |
Node.js |
TESTS |
25 |
187 |
4915200 |
|
1700 |
44815851 |
sk0 |
C |
Oct. 24, 2018, 9:21 p.m. |
OK |
Ocaml |
TESTS |
25 |
15 |
0 |
|
1700 |
44806934 |
Arcadii |
C |
Oct. 24, 2018, 6:12 p.m. |
OK |
PascalABC.NET |
TESTS |
25 |
93 |
1740800 |
|
1700 |
45613469 |
KGYYT |
C |
Nov. 12, 2018, 3:23 p.m. |
OK |
PascalABC.NET |
TESTS |
25 |
108 |
1740800 |
|
1700 |
44798892 |
frederika |
C |
Oct. 24, 2018, 5:33 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
202 |
1740800 |
|
1700 |
44820313 |
aeternalis1 |
C |
Oct. 25, 2018, 1:36 a.m. |
OK |
PyPy 2 |
TESTS |
25 |
202 |
2560000 |
|
1700 |
44814170 |
PBatch |
C |
Oct. 24, 2018, 8:34 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
234 |
3481600 |
|
1700 |
44813819 |
YESMAths |
C |
Oct. 24, 2018, 8:27 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
264 |
22732800 |
|
1700 |
44956098 |
cgfs10000 |
C |
Oct. 27, 2018, 2:18 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
155 |
2150400 |
|
1700 |
44791813 |
Grevozin |
C |
Oct. 24, 2018, 5:08 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
170 |
1024000 |
|
1700 |
45466963 |
sonya123 |
C |
Nov. 9, 2018, 6:39 a.m. |
OK |
PyPy 3 |
TESTS |
25 |
171 |
819200 |
|
1700 |
45232227 |
Firepaw |
C |
Nov. 3, 2018, 7:37 a.m. |
OK |
PyPy 3 |
TESTS |
25 |
171 |
819200 |
|
1700 |
46036261 |
..vince |
C |
Nov. 21, 2018, 4:34 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
171 |
2969600 |
|
1700 |
44878382 |
notbot |
C |
Oct. 25, 2018, 5:59 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
171 |
3072000 |
|
1700 |
44796627 |
_Kee |
C |
Oct. 24, 2018, 5:24 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
186 |
2150400 |
|
1700 |
45417372 |
hrustim25 |
C |
Nov. 7, 2018, 3:03 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
186 |
3174400 |
|
1700 |
45232163 |
Firepaw |
C |
Nov. 3, 2018, 7:35 a.m. |
OK |
PyPy 3 |
TESTS |
25 |
187 |
2764800 |
|
1700 |
44800044 |
fikr |
C |
Oct. 24, 2018, 5:38 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
187 |
2867200 |
|
1700 |
45037616 |
SoSooding |
C |
Oct. 29, 2018, 8:36 a.m. |
OK |
Python 2 |
TESTS |
25 |
171 |
102400 |
|
1700 |
44818052 |
thuglife69 |
C |
Oct. 24, 2018, 11:03 p.m. |
OK |
Python 2 |
TESTS |
25 |
233 |
102400 |
|
1700 |
45442412 |
teitoku |
C |
Nov. 8, 2018, 11:50 a.m. |
OK |
Python 3 |
TESTS |
25 |
109 |
204800 |
|
1700 |
44797077 |
jlee |
C |
Oct. 24, 2018, 5:26 p.m. |
OK |
Python 3 |
TESTS |
25 |
109 |
307200 |
|
1700 |
44822450 |
tmsausa |
C |
Oct. 25, 2018, 3:32 a.m. |
OK |
Python 3 |
TESTS |
25 |
109 |
409600 |
|
1700 |
45328288 |
mart.slaaf |
C |
Nov. 5, 2018, 1:58 p.m. |
OK |
Python 3 |
TESTS |
25 |
109 |
614400 |
|
1700 |
45239261 |
nowyyz |
C |
Nov. 3, 2018, 10:52 a.m. |
OK |
Python 3 |
TESTS |
25 |
124 |
0 |
|
1700 |
44805175 |
dimal97 |
C |
Oct. 24, 2018, 6:03 p.m. |
OK |
Python 3 |
TESTS |
25 |
124 |
0 |
|
1700 |
44814255 |
fbsham102 |
C |
Oct. 24, 2018, 8:36 p.m. |
OK |
Python 3 |
TESTS |
25 |
124 |
307200 |
|
1700 |
44805391 |
Alex_Shir |
C |
Oct. 24, 2018, 6:04 p.m. |
OK |
Python 3 |
TESTS |
25 |
124 |
307200 |
|
1700 |
44803879 |
weizhao |
C |
Oct. 24, 2018, 5:56 p.m. |
OK |
Python 3 |
TESTS |
25 |
124 |
307200 |
|
1700 |
44799956 |
Ferume |
C |
Oct. 24, 2018, 5:38 p.m. |
OK |
Python 3 |
TESTS |
25 |
124 |
307200 |
|
1700 |
44800384 |
yakamoto |
C |
Oct. 24, 2018, 5:40 p.m. |
OK |
Scala |
TESTS |
25 |
452 |
0 |
|
1700 |
remove filters
Back to search problems