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'One of Timofey 's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 different colors in such a way that every two rectangles touching each other by side would have different color, or determine that it is impossible. Two rectangles intersect if their intersection has positive area. Two rectangles touch by sides if there is a pair of sides such that their intersection has non-zero length The first line contains single integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x895 xc2 xb7105) -- the number of rectangles. n lines follow. The i-th of these lines contains four integers x1, y1, x2 and y2 ( xe2 x80 x89- xe2 x80 x89109 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89x1 xe2 x80 x89< xe2 x80 x89x2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109, xe2 x80 x89- xe2 x80 x89109 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89y1 xe2 x80 x89< xe2 x80 x89y2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109), that means that points (x1, xe2 x80 x89y1) and (x2, xe2 x80 x89y2) are the coordinates of two opposite corners of the i-th rectangle. It is guaranteed, that all sides of the rectangles have odd lengths and rectangles don 't intersect each other. Print "NO" in the only line if it is impossible to color the rectangles in 4 different colors in such a way that every two rectangles touching each other by side would have different color. Otherwise, print "YES" in the first line. Then print n lines, in the i-th of them print single integer ci (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ci xe2 x80 x89 xe2 x89 xa4 xe2 x80 x894) -- the color of i-th rectangle. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
24640277 |
lkmcfj |
B |
Feb. 14, 2017, 1:49 a.m. |
OK |
FPC |
TESTS |
47 |
265 |
1638400 |
|
2200 |
49650180 |
ys_lin |
B |
Feb. 9, 2019, 7:10 a.m. |
OK |
FPC |
TESTS |
47 |
373 |
0 |
|
2200 |
69546711 |
stuzjk |
B |
Jan. 26, 2020, 3:28 a.m. |
OK |
FPC |
TESTS |
47 |
374 |
204800 |
|
2200 |
24404889 |
.vinccce |
B |
Feb. 3, 2017, 8:05 a.m. |
OK |
GNU C |
TESTS |
47 |
93 |
1843200 |
|
2200 |
24477586 |
mouez292 |
B |
Feb. 6, 2017, 10:35 p.m. |
OK |
GNU C |
TESTS |
47 |
93 |
1843200 |
|
2200 |
24409919 |
cxNka- |
B |
Feb. 3, 2017, 12:28 p.m. |
OK |
GNU C |
TESTS |
47 |
108 |
9932800 |
|
2200 |
31941067 |
negiizhao |
B |
Nov. 1, 2017, 7:26 a.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
0 |
|
2200 |
39462041 |
Siyuan |
B |
June 21, 2018, 12:34 p.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
819200 |
|
2200 |
24375645 |
Xiejiadong |
B |
Feb. 2, 2017, 2:11 p.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
2150400 |
|
2200 |
31707273 |
qaz_kyle |
B |
Oct. 25, 2017, 11:38 a.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
0 |
|
2200 |
41573795 |
Scut82 |
B |
Aug. 14, 2018, 2:10 a.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
0 |
|
2200 |
41573113 |
Scut82 |
B |
Aug. 14, 2018, 1:24 a.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
0 |
|
2200 |
41572262 |
Scut82 |
B |
Aug. 13, 2018, 11:46 p.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
0 |
|
2200 |
39334002 |
luogu_bot5 |
B |
June 17, 2018, 11:39 a.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
0 |
|
2200 |
29634911 |
vjudge4 |
B |
Aug. 21, 2017, 4:50 a.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
0 |
|
2200 |
39461977 |
Siyuan |
B |
June 21, 2018, 12:31 p.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
819200 |
|
2200 |
57931539 |
luogu_bot2 |
B |
July 29, 2019, 8:54 a.m. |
OK |
GNU C11 |
TESTS |
47 |
358 |
0 |
|
2200 |
24400785 |
Ajatar |
B |
Feb. 3, 2017, 3:34 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
1843200 |
|
2200 |
24407590 |
VAVAvile |
B |
Feb. 3, 2017, 10:33 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
2048000 |
|
2200 |
24393715 |
-Sali- |
B |
Feb. 2, 2017, 6:52 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
2048000 |
|
2200 |
24373486 |
rxdoi |
B |
Feb. 2, 2017, 2 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
2048000 |
|
2200 |
28304152 |
zykzhenshuai |
B |
July 5, 2017, 12:47 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
10137600 |
|
2200 |
24373227 |
ditoly |
B |
Feb. 2, 2017, 1:59 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
1843200 |
|
2200 |
28382093 |
Hermits |
B |
July 9, 2017, 6:51 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
1945600 |
|
2200 |
24375107 |
FailedSystemTest |
B |
Feb. 2, 2017, 2:08 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
2048000 |
|
2200 |
24382314 |
King_George |
B |
Feb. 2, 2017, 2:59 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
2048000 |
|
2200 |
24626895 |
GEOTCBRL |
B |
Feb. 13, 2017, 11:53 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
2150400 |
|
2200 |
24390716 |
I_Love_Tina |
B |
Feb. 2, 2017, 5:15 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
31 |
1945600 |
|
2200 |
40982581 |
ReaLNero1 |
B |
July 30, 2018, 6:29 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
31 |
2048000 |
|
2200 |
24374102 |
Egor.Lifar |
B |
Feb. 2, 2017, 2:03 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
31 |
3891200 |
|
2200 |
29188428 |
abutoto |
B |
Aug. 4, 2017, 8:22 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
77 |
2764800 |
|
2200 |
40352836 |
shivsharmastr |
B |
July 14, 2018, 6:03 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
78 |
0 |
|
2200 |
62394727 |
vjudge2 |
B |
Oct. 12, 2019, 4:52 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
78 |
0 |
|
2200 |
24376189 |
alex9801 |
B |
Feb. 2, 2017, 2:14 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
78 |
1843200 |
|
2200 |
25808098 |
lzh0108 |
B |
March 25, 2017, 11:28 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
78 |
1843200 |
|
2200 |
24399386 |
GeKa |
B |
Feb. 3, 2017, 1:40 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
78 |
1945600 |
|
2200 |
26519853 |
tataky |
B |
April 20, 2017, 2:55 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
78 |
1945600 |
|
2200 |
46911767 |
vitmaann |
B |
Dec. 11, 2018, 5:21 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
93 |
0 |
|
2200 |
39695078 |
zoomswk |
B |
June 27, 2018, 8:05 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
93 |
0 |
|
2200 |
64400962 |
alexradu04 |
B |
Nov. 6, 2019, 4:11 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
93 |
0 |
|
2200 |
54141836 |
MetB |
B |
May 14, 2019, 5:59 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
108 |
0 |
|
2200 |
56580325 |
eduardonunes2525 |
B |
July 5, 2019, 4:06 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
108 |
0 |
|
2200 |
47504480 |
KevinWan |
B |
Dec. 25, 2018, 8:53 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
108 |
0 |
|
2200 |
52307029 |
vjudge4 |
B |
April 4, 2019, 12:44 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
108 |
8396800 |
|
2200 |
41244001 |
jonathansilver |
B |
Aug. 5, 2018, 12:04 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
109 |
0 |
|
2200 |
69022550 |
ZXyang HeRaNO krazy |
B |
Jan. 18, 2020, 6:37 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
109 |
0 |
|
2200 |
62594946 |
vjudge3 |
B |
Oct. 15, 2019, 12:53 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
109 |
0 |
|
2200 |
24434687 |
fengsuiyan |
B |
Feb. 4, 2017, 3:05 p.m. |
OK |
Haskell |
TESTS |
47 |
202 |
71270400 |
|
2200 |
47286540 |
PrakharJain |
B |
Dec. 20, 2018, 6:33 a.m. |
OK |
Java 8 |
TESTS |
47 |
140 |
0 |
|
2200 |
47286354 |
PrakharJain |
B |
Dec. 20, 2018, 6:25 a.m. |
OK |
Java 8 |
TESTS |
47 |
140 |
0 |
|
2200 |
47286530 |
PrakharJain |
B |
Dec. 20, 2018, 6:32 a.m. |
OK |
Java 8 |
TESTS |
47 |
155 |
0 |
|
2200 |
24437655 |
Wolfje |
B |
Feb. 4, 2017, 5:23 p.m. |
OK |
Java 8 |
TESTS |
47 |
155 |
20582400 |
|
2200 |
24370506 |
uwi |
B |
Feb. 2, 2017, 1:49 p.m. |
OK |
Java 8 |
TESTS |
47 |
156 |
20582400 |
|
2200 |
24418337 |
prashanth_rebala |
B |
Feb. 3, 2017, 6:54 p.m. |
OK |
Java 8 |
TESTS |
47 |
170 |
20480000 |
|
2200 |
24420312 |
beroul |
B |
Feb. 3, 2017, 8:49 p.m. |
OK |
Java 8 |
TESTS |
47 |
171 |
20684800 |
|
2200 |
24377809 |
IgorKoval |
B |
Feb. 2, 2017, 2:25 p.m. |
OK |
Java 8 |
TESTS |
47 |
186 |
20582400 |
|
2200 |
24388752 |
poikniok |
B |
Feb. 2, 2017, 4:35 p.m. |
OK |
Java 8 |
TESTS |
47 |
186 |
20684800 |
|
2200 |
24418232 |
prashanth_rebala |
B |
Feb. 3, 2017, 6:49 p.m. |
OK |
Java 8 |
TESTS |
47 |
187 |
20480000 |
|
2200 |
24372504 |
riantkb |
B |
Feb. 2, 2017, 1:56 p.m. |
OK |
Mono C# |
TESTS |
47 |
249 |
14336000 |
|
2200 |
24633725 |
og.kostya |
B |
Feb. 13, 2017, 6:01 p.m. |
OK |
MS C# |
TESTS |
47 |
93 |
14233600 |
|
2200 |
24421695 |
freepvps |
B |
Feb. 3, 2017, 10:55 p.m. |
OK |
MS C# |
TESTS |
47 |
530 |
11878400 |
|
2200 |
24410671 |
pomjuice |
B |
Feb. 3, 2017, 12:57 p.m. |
OK |
MS C# |
TESTS |
47 |
857 |
41369600 |
|
2200 |
24372245 |
TonySnark |
B |
Feb. 2, 2017, 1:55 p.m. |
OK |
MS C++ |
TESTS |
47 |
77 |
2048000 |
|
2200 |
24378488 |
AleksanderBalobanov |
B |
Feb. 2, 2017, 2:29 p.m. |
OK |
MS C++ |
TESTS |
47 |
77 |
2048000 |
|
2200 |
56694391 |
Tkachova |
B |
July 8, 2019, 6:14 a.m. |
OK |
MS C++ |
TESTS |
47 |
78 |
0 |
|
2200 |
29827318 |
vjudge3 |
B |
Aug. 27, 2017, 1:22 p.m. |
OK |
MS C++ |
TESTS |
47 |
78 |
102400 |
|
2200 |
24521167 |
jslijin |
B |
Feb. 8, 2017, 8:09 a.m. |
OK |
MS C++ |
TESTS |
47 |
78 |
2048000 |
|
2200 |
24859840 |
vjudge4 |
B |
Feb. 21, 2017, 3 a.m. |
OK |
MS C++ |
TESTS |
47 |
78 |
6144000 |
|
2200 |
24378794 |
Perforator |
B |
Feb. 2, 2017, 2:31 p.m. |
OK |
MS C++ |
TESTS |
47 |
78 |
20070400 |
|
2200 |
24368671 |
KungA |
B |
Feb. 2, 2017, 1:44 p.m. |
OK |
MS C++ |
TESTS |
47 |
92 |
2048000 |
|
2200 |
24374403 |
Madball |
B |
Feb. 2, 2017, 2:04 p.m. |
OK |
MS C++ |
TESTS |
47 |
93 |
2048000 |
|
2200 |
24470897 |
SSW |
B |
Feb. 6, 2017, 3:10 p.m. |
OK |
MS C++ |
TESTS |
47 |
109 |
2048000 |
|
2200 |
56696648 |
Tkachova |
B |
July 8, 2019, 7:20 a.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
702 |
0 |
|
2200 |
24400843 |
alexwice |
B |
Feb. 3, 2017, 3:38 a.m. |
OK |
PyPy 2 |
TESTS |
47 |
904 |
30310400 |
|
2200 |
24458678 |
Yash_ |
B |
Feb. 5, 2017, 8:11 p.m. |
OK |
PyPy 2 |
TESTS |
47 |
1153 |
24985600 |
|
2200 |
24397305 |
Noureldin |
B |
Feb. 2, 2017, 10:12 p.m. |
OK |
PyPy 2 |
TESTS |
47 |
1200 |
24985600 |
|
2200 |
24491740 |
helen123 |
B |
Feb. 7, 2017, 4:05 p.m. |
OK |
Python 2 |
TESTS |
47 |
311 |
30822400 |
|
2200 |
24394254 |
andrevs |
B |
Feb. 2, 2017, 7:15 p.m. |
OK |
Python 2 |
TESTS |
47 |
390 |
23859200 |
|
2200 |
31366139 |
biltharesatyendra |
B |
Oct. 15, 2017, 1:12 p.m. |
OK |
Python 2 |
TESTS |
47 |
514 |
4608000 |
|
2200 |
24394381 |
andrevs |
B |
Feb. 2, 2017, 7:20 p.m. |
OK |
Python 2 |
TESTS |
47 |
514 |
18227200 |
|
2200 |
24388488 |
Vosatorp |
B |
Feb. 2, 2017, 4:31 p.m. |
OK |
Python 3 |
TESTS |
47 |
545 |
6348800 |
|
2200 |
32482552 |
yugle7 |
B |
Nov. 19, 2017, 7:38 p.m. |
OK |
Python 3 |
TESTS |
47 |
1231 |
5529600 |
|
2200 |
49547016 |
ivan100sic |
B |
Feb. 7, 2019, 12:22 a.m. |
OK |
Python 3 |
TESTS |
47 |
1247 |
0 |
|
2200 |
24392993 |
MStrechen |
B |
Feb. 2, 2017, 6:25 p.m. |
OK |
Python 3 |
TESTS |
47 |
1403 |
4915200 |
|
2200 |
40547689 |
DeadPillow |
B |
July 19, 2018, 12:40 p.m. |
OK |
Python 3 |
TESTS |
47 |
1434 |
0 |
|
2200 |
36708326 |
vjudge2 |
B |
March 29, 2018, 3:30 a.m. |
OK |
Python 3 |
TESTS |
47 |
1481 |
7372800 |
|
2200 |
24629016 |
wiwitrifai |
B |
Feb. 13, 2017, 1:48 p.m. |
OK |
Python 3 |
TESTS |
47 |
1496 |
4608000 |
|
2200 |
42130707 |
Mk_Python_v1 |
B |
Aug. 26, 2018, 6:21 p.m. |
OK |
Python 3 |
TESTS |
47 |
1497 |
0 |
|
2200 |
24410825 |
Mustafa215 |
B |
Feb. 3, 2017, 1:03 p.m. |
OK |
Python 3 |
TESTS |
47 |
1887 |
4608000 |
|
2200 |
24388309 |
cojna |
B |
Feb. 2, 2017, 4:26 p.m. |
OK |
Rust |
TESTS |
47 |
389 |
1536000 |
|
2200 |
24373510 |
kobae964 |
B |
Feb. 2, 2017, 2 p.m. |
OK |
Rust |
TESTS |
47 |
545 |
1536000 |
|
2200 |
remove filters
Back to search problems