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 are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1 , n_2 and n_3 . Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: If there are multiple valid labelings, print any of them. The first line contains two integers n and m ( 1 <= n <= 5000 ; 0 <= m <= 10^5 ) -- the number of vertices and edges in the graph. The second line contains three integers n_1 , n_2 and n_3 ( 0 <= n_1, n_2, n_3 <= n ) -- the number of labels 1, 2 and 3, respectively. It 's guaranteed that n_1 + n_2 + n_3 = n . Next m lines contan description of edges: the i -th line contains two integers u_i , v_i ( 1 <= u_i, v_i <= n ; u_i neq v_i ) -- the vertices the i -th edge connects. It 's guaranteed that the graph doesn 't contain self-loops or multiple edges. If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length n consisting of 1, 2 and 3. The i -th letter should be equal to the label of the i -th vertex. If there is no valid labeling, print "NO" (without quotes). '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
80664560 |
SleepZzz |
E |
May 19, 2020, 7:30 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
31 |
3788800 |
|
2100 |
80817997 |
msuwakow |
E |
May 21, 2020, 3:44 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
31 |
7884800 |
|
2100 |
80624679 |
UnoK |
E |
May 18, 2020, 4:53 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
31 |
103424000 |
|
2100 |
80821581 |
Rainbow_sjy |
E |
May 21, 2020, 5:20 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
46 |
1945600 |
|
2100 |
80821554 |
Rainbow_sjy |
E |
May 21, 2020, 5:20 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
46 |
2150400 |
|
2100 |
80661911 |
WaAccept |
E |
May 19, 2020, 6:49 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
46 |
26624000 |
|
2100 |
80981413 |
zhang0617 |
E |
May 23, 2020, 3:58 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
46 |
27136000 |
|
2100 |
80981398 |
zhang0617 |
E |
May 23, 2020, 3:57 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
46 |
27136000 |
|
2100 |
80536359 |
acccccccc |
E |
May 17, 2020, 4:01 p.m. |
OK |
GNU C++11 |
TESTS |
38 |
46 |
29184000 |
|
2100 |
80537648 |
TrivialMan |
E |
May 17, 2020, 4:19 p.m. |
OK |
GNU C++11 |
TESTS |
38 |
46 |
29286400 |
|
2100 |
80645656 |
asdkjc |
E |
May 19, 2020, 12:23 a.m. |
OK |
GNU C++14 |
TESTS |
40 |
31 |
2048000 |
|
2100 |
80514631 |
rk42745417 |
E |
May 17, 2020, 11:35 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
31 |
7270400 |
|
2100 |
80793458 |
txingml |
E |
May 20, 2020, 5:03 p.m. |
OK |
GNU C++14 |
TESTS |
41 |
46 |
1536000 |
|
2100 |
80542537 |
suji.ka.halwa |
E |
May 17, 2020, 5:27 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
46 |
7475200 |
|
2100 |
80680607 |
bary |
E |
May 19, 2020, 11:11 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
46 |
25600000 |
|
2100 |
80736989 |
anubhavp |
E |
May 20, 2020, 3:09 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
46 |
26521600 |
|
2100 |
81148287 |
sega_hsj |
E |
May 24, 2020, 8:26 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
46 |
26624000 |
|
2100 |
81373293 |
TSwiftie |
E |
May 25, 2020, 10:40 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
46 |
26931200 |
|
2100 |
80719734 |
Frozen_Guardian |
E |
May 19, 2020, 6:50 p.m. |
OK |
GNU C++14 |
TESTS |
41 |
46 |
27545600 |
|
2100 |
80929585 |
sahilnikum |
E |
May 22, 2020, 11:38 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
46 |
28057600 |
|
2100 |
80621033 |
Ricktarded |
E |
May 18, 2020, 4:10 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
31 |
3481600 |
|
2100 |
80827800 |
nickluo |
E |
May 21, 2020, 7:04 a.m. |
OK |
GNU C++17 |
TESTS |
41 |
31 |
5120000 |
|
2100 |
80519021 |
Arpa |
E |
May 17, 2020, 12:21 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
31 |
7372800 |
|
2100 |
80566390 |
Anachor |
E |
May 18, 2020, 3:44 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
31 |
7577600 |
|
2100 |
80554616 |
Avocado |
E |
May 17, 2020, 9:05 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
31 |
7680000 |
|
2100 |
80595386 |
DimmyT |
E |
May 18, 2020, 11:12 a.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
8499200 |
|
2100 |
80524408 |
qfhy |
E |
May 17, 2020, 1:37 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
31 |
30515200 |
|
2100 |
80803581 |
anArtist |
E |
May 20, 2020, 7:42 p.m. |
OK |
GNU C++17 |
TESTS |
41 |
46 |
1433600 |
|
2100 |
80951634 |
Void_Monitor |
E |
May 22, 2020, 4:14 p.m. |
OK |
GNU C++17 |
TESTS |
41 |
46 |
1536000 |
|
2100 |
80835060 |
arktan763 |
E |
May 21, 2020, 8:49 a.m. |
OK |
GNU C++17 |
TESTS |
41 |
46 |
3584000 |
|
2100 |
81454032 |
cjy2003 |
E |
May 26, 2020, 9:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
31 |
7168000 |
|
2100 |
80566907 |
WZYYN |
E |
May 18, 2020, 3:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
31 |
7577600 |
|
2100 |
80534106 |
neal |
E |
May 17, 2020, 3:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
31 |
8396800 |
|
2100 |
80563014 |
YangDavid |
E |
May 18, 2020, 2:19 a.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
31 |
8499200 |
|
2100 |
80522624 |
michao |
E |
May 17, 2020, 1:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
31 |
10240000 |
|
2100 |
81383910 |
olphe |
E |
May 25, 2020, 12:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
46 |
3788800 |
|
2100 |
80999950 |
besieger |
E |
May 23, 2020, 9:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
46 |
3891200 |
|
2100 |
81054840 |
tyler |
E |
May 24, 2020, 1:40 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
46 |
4198400 |
|
2100 |
80606515 |
hugopm |
E |
May 18, 2020, 1:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
11878400 |
|
2100 |
81024731 |
ivan100sic |
E |
May 23, 2020, 3:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
46 |
27033600 |
|
2100 |
80730856 |
dauom |
E |
May 19, 2020, 11:45 p.m. |
OK |
Java 11 |
TESTS |
41 |
280 |
39321600 |
|
2100 |
81435737 |
bobib |
E |
May 26, 2020, 4:40 a.m. |
OK |
Java 11 |
TESTS |
41 |
295 |
40345600 |
|
2100 |
80646477 |
egaeus.code |
E |
May 19, 2020, 12:52 a.m. |
OK |
Java 11 |
TESTS |
40 |
311 |
146022400 |
|
2100 |
80647473 |
derrick20 |
E |
May 19, 2020, 1:32 a.m. |
OK |
Java 11 |
TESTS |
40 |
326 |
144179200 |
|
2100 |
80862019 |
jakejase2 |
E |
May 21, 2020, 2:34 p.m. |
OK |
Java 11 |
TESTS |
41 |
342 |
145408000 |
|
2100 |
80707579 |
TheSawan |
E |
May 19, 2020, 4:13 p.m. |
OK |
Java 11 |
TESTS |
41 |
342 |
145715200 |
|
2100 |
80629262 |
jenish9599 |
E |
May 18, 2020, 5:58 p.m. |
OK |
Java 11 |
TESTS |
40 |
358 |
40038400 |
|
2100 |
80831665 |
zhupeijun |
E |
May 21, 2020, 8:04 a.m. |
OK |
Java 11 |
TESTS |
41 |
389 |
150220800 |
|
2100 |
80646608 |
derrick20 |
E |
May 19, 2020, 12:57 a.m. |
OK |
Java 11 |
TESTS |
40 |
404 |
260608000 |
|
2100 |
80646913 |
derrick20 |
E |
May 19, 2020, 1:09 a.m. |
OK |
Java 11 |
TESTS |
40 |
405 |
260505600 |
|
2100 |
81165952 |
vengalraoguttha |
E |
May 24, 2020, 10:21 a.m. |
OK |
Java 8 |
TESTS |
41 |
155 |
39116800 |
|
2100 |
80942608 |
7dan |
E |
May 22, 2020, 2:32 p.m. |
OK |
Java 8 |
TESTS |
41 |
249 |
38195200 |
|
2100 |
80610337 |
MagentaCobra |
E |
May 18, 2020, 2:15 p.m. |
OK |
Java 8 |
TESTS |
40 |
249 |
178585600 |
|
2100 |
80750866 |
mufaddalnaya |
E |
May 20, 2020, 7:39 a.m. |
OK |
Java 8 |
TESTS |
41 |
264 |
37068800 |
|
2100 |
80754473 |
mufaddalnaya |
E |
May 20, 2020, 8:32 a.m. |
OK |
Java 8 |
TESTS |
41 |
264 |
38707200 |
|
2100 |
80698534 |
533.sandyhu |
E |
May 19, 2020, 2:36 p.m. |
OK |
Java 8 |
TESTS |
41 |
264 |
73318400 |
|
2100 |
81198471 |
yaoct |
E |
May 24, 2020, 12:35 p.m. |
OK |
Java 8 |
TESTS |
41 |
265 |
142438400 |
|
2100 |
81052956 |
MagentaCobra |
E |
May 24, 2020, midnight |
OK |
Java 8 |
TESTS |
41 |
280 |
137216000 |
|
2100 |
80770848 |
turing_fan123 |
E |
May 20, 2020, 12:13 p.m. |
OK |
Java 8 |
TESTS |
41 |
280 |
144793600 |
|
2100 |
80642796 |
golions |
E |
May 18, 2020, 10:27 p.m. |
OK |
Java 8 |
TESTS |
40 |
280 |
153395200 |
|
2100 |
81041385 |
MadMax |
E |
May 23, 2020, 6:48 p.m. |
OK |
Kotlin |
TESTS |
41 |
249 |
1536000 |
|
2100 |
81372953 |
cristian1997 |
E |
May 25, 2020, 10:36 a.m. |
OK |
Kotlin |
TESTS |
41 |
296 |
73932800 |
|
2100 |
80555915 |
Cyber.1 |
E |
May 17, 2020, 9:43 p.m. |
OK |
Kotlin |
TESTS |
38 |
311 |
38912000 |
|
2100 |
80850830 |
Spheniscine |
E |
May 21, 2020, 12:21 p.m. |
OK |
Kotlin |
TESTS |
41 |
326 |
151244800 |
|
2100 |
80555075 |
Cyber.1 |
E |
May 17, 2020, 9:16 p.m. |
OK |
Kotlin |
TESTS |
38 |
327 |
39321600 |
|
2100 |
80564809 |
Tlatoani |
E |
May 18, 2020, 3:05 a.m. |
OK |
Kotlin |
TESTS |
38 |
436 |
169164800 |
|
2100 |
81592671 |
LSD |
E |
May 27, 2020, 7:28 a.m. |
OK |
MS C++ 2017 |
TESTS |
41 |
124 |
3788800 |
|
2100 |
80695203 |
getN1ght |
E |
May 19, 2020, 2:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
41 |
124 |
3891200 |
|
2100 |
81022561 |
pikachan14 |
E |
May 23, 2020, 2:34 p.m. |
OK |
MS C++ 2017 |
TESTS |
41 |
124 |
100966400 |
|
2100 |
81022535 |
akai14 |
E |
May 23, 2020, 2:34 p.m. |
OK |
MS C++ 2017 |
TESTS |
41 |
124 |
100966400 |
|
2100 |
80770572 |
0Mordecai0 |
E |
May 20, 2020, 12:09 p.m. |
OK |
MS C++ 2017 |
TESTS |
41 |
124 |
103116800 |
|
2100 |
80816517 |
Najmus_Sakib_Rashid |
E |
May 21, 2020, 3:03 a.m. |
OK |
MS C++ 2017 |
TESTS |
41 |
140 |
203776000 |
|
2100 |
81425414 |
yumtam |
E |
May 25, 2020, 11:28 p.m. |
OK |
PyPy 2 |
TESTS |
41 |
716 |
202752000 |
|
2100 |
80522357 |
Galkowsky |
E |
May 17, 2020, 1:08 p.m. |
OK |
PyPy 3 |
TESTS |
38 |
296 |
123699200 |
|
2100 |
80523460 |
Galkowsky |
E |
May 17, 2020, 1:24 p.m. |
OK |
PyPy 3 |
TESTS |
38 |
311 |
123801600 |
|
2100 |
80798444 |
siyy |
E |
May 20, 2020, 6:15 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
389 |
80588800 |
|
2100 |
80798812 |
siyy |
E |
May 20, 2020, 6:21 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
405 |
80486400 |
|
2100 |
80708963 |
nehan_der_thal |
E |
May 19, 2020, 4:32 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
467 |
104140800 |
|
2100 |
80694967 |
aberent |
E |
May 19, 2020, 2 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
498 |
113766400 |
|
2100 |
80710738 |
roaris |
E |
May 19, 2020, 4:54 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
529 |
104652800 |
|
2100 |
80670869 |
Alex_Savitskiy |
E |
May 19, 2020, 8:57 a.m. |
OK |
PyPy 3 |
TESTS |
41 |
842 |
104755200 |
|
2100 |
80671676 |
ravinem1 |
E |
May 19, 2020, 9:08 a.m. |
OK |
PyPy 3 |
TESTS |
41 |
857 |
114073600 |
|
2100 |
80602413 |
wattaihei |
E |
May 18, 2020, 12:38 p.m. |
OK |
PyPy 3 |
TESTS |
40 |
967 |
123084800 |
|
2100 |
80619229 |
cotton100pc |
E |
May 18, 2020, 3:50 p.m. |
OK |
Rust |
TESTS |
40 |
62 |
25497600 |
|
2100 |
remove filters
Back to search problems