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'Students of Winter Informatics School are going to live in a set of houses connected by underground passages. Teachers are also going to live in some of these houses, but they can not be accommodated randomly. For safety reasons, the following must hold: Please help the organizers to choose the houses where teachers will live to satisfy the safety requirements or determine that it is impossible. The first input line contains a single integer t -- the number of test cases ( 1 <= t <= 10^5 ). Each test case starts with two integers n and m ( 2 <= n <= 3 cdot 10^5 , 0 <= m <= 3 cdot 10^5 ) -- the number of houses and the number of passages. Then m lines follow, each of them contains two integers u and v ( 1 <= u, v <= n , u neq v ), describing a passage between the houses u and v . It is guaranteed that there are no two passages connecting the same pair of houses. The sum of values n over all test cases does not exceed 3 cdot 10^5 , and the sum of values m over all test cases does not exceed 3 cdot 10^5 . For each test case, if there is no way to choose the desired set of houses, output "NO". Otherwise, output "YES", then the total number of houses chosen, and then the indices of the chosen houses in arbitrary order. The picture below shows the second example test. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
103476177 |
Gassa |
D |
Jan. 5, 2021, 7:26 p.m. |
OK |
D |
TESTS |
44 |
390 |
25702400 |
|
|
103458863 |
fishcathu. |
D |
Jan. 5, 2021, 4:30 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
93 |
9011200 |
|
|
103429668 |
ezoilearner |
D |
Jan. 5, 2021, 3:30 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
108 |
9625600 |
|
|
103498065 |
jzp |
D |
Jan. 6, 2021, 3:49 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
139 |
16793600 |
|
|
103473098 |
myx12345 |
D |
Jan. 5, 2021, 6:52 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
140 |
12492800 |
|
|
103431782 |
SSerxhs |
D |
Jan. 5, 2021, 3:34 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
140 |
23552000 |
|
|
103500528 |
SSerxhs |
D |
Jan. 6, 2021, 4:33 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
140 |
23552000 |
|
|
103453147 |
szhlg |
D |
Jan. 5, 2021, 4:18 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
140 |
30003200 |
|
|
103506317 |
Acranker |
D |
Jan. 6, 2021, 5:57 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
171 |
9625600 |
|
|
103453605 |
smarthehe |
D |
Jan. 5, 2021, 4:19 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
171 |
15872000 |
|
|
103449603 |
diamond_dick |
D |
Jan. 5, 2021, 4:10 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
171 |
19660800 |
|
|
103502303 |
Nietzsche233 |
D |
Jan. 6, 2021, 5:01 a.m. |
OK |
GNU C++14 |
TESTS |
44 |
202 |
15462400 |
|
|
103494566 |
farmerboy |
D |
Jan. 6, 2021, 2:36 a.m. |
OK |
GNU C++14 |
TESTS |
44 |
264 |
11980800 |
|
|
103454618 |
Devil |
D |
Jan. 5, 2021, 4:21 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
265 |
16588800 |
|
|
103481854 |
RuthlessPractice |
D |
Jan. 5, 2021, 8:51 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
280 |
14950400 |
|
|
103492184 |
Nero |
D |
Jan. 6, 2021, 1:34 a.m. |
OK |
GNU C++14 |
TESTS |
44 |
280 |
15667200 |
|
|
103428512 |
AgReB |
D |
Jan. 5, 2021, 3:28 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
280 |
15667200 |
|
|
103437189 |
Zoli9 |
D |
Jan. 5, 2021, 3:43 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
280 |
16691200 |
|
|
103476590 |
SuperJ6 |
D |
Jan. 5, 2021, 7:31 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
280 |
16793600 |
|
|
103456093 |
liyh |
D |
Jan. 5, 2021, 4:24 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
280 |
16998400 |
|
|
103440319 |
clyring |
D |
Jan. 5, 2021, 3:50 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
295 |
13209600 |
|
|
103490604 |
Cirno_9baka |
D |
Jan. 6, 2021, 12:52 a.m. |
OK |
GNU C++17 |
TESTS |
44 |
202 |
8396800 |
|
|
103447271 |
Hazyknight |
D |
Jan. 5, 2021, 4:04 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
217 |
11059200 |
|
|
103506030 |
daniel071292 |
D |
Jan. 6, 2021, 5:54 a.m. |
OK |
GNU C++17 |
TESTS |
44 |
264 |
14643200 |
|
|
103476701 |
Golden |
D |
Jan. 5, 2021, 7:33 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
264 |
15052800 |
|
|
103491635 |
generic_placeholder_name |
D |
Jan. 6, 2021, 1:20 a.m. |
OK |
GNU C++17 |
TESTS |
44 |
265 |
14540800 |
|
|
103484581 |
maximumSHOT |
D |
Jan. 5, 2021, 9:50 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
265 |
16793600 |
|
|
103488408 |
Solnechniy_kray |
D |
Jan. 5, 2021, 11:39 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
280 |
14336000 |
|
|
103446091 |
rdd6584 |
D |
Jan. 5, 2021, 4:02 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
280 |
15052800 |
|
|
103439424 |
MyK_00L |
D |
Jan. 5, 2021, 3:48 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
280 |
15257600 |
|
|
103500662 |
codicon |
D |
Jan. 6, 2021, 4:35 a.m. |
OK |
GNU C++17 |
TESTS |
44 |
280 |
15667200 |
|
|
103438634 |
LayCurse |
D |
Jan. 5, 2021, 3:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
108 |
105472000 |
|
|
103453080 |
NotaMotuaQAQ |
D |
Jan. 5, 2021, 4:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
187 |
23449600 |
|
|
103476952 |
Linkus |
D |
Jan. 5, 2021, 7:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
233 |
37785600 |
|
|
103500864 |
qdd |
D |
Jan. 6, 2021, 4:39 a.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
248 |
16793600 |
|
|
103484445 |
wassim.omais |
D |
Jan. 5, 2021, 9:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
248 |
16793600 |
|
|
103492547 |
wgx666 |
D |
Jan. 6, 2021, 1:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
248 |
19148800 |
|
|
103420026 |
Arpa |
D |
Jan. 5, 2021, 3:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
249 |
16793600 |
|
|
103490618 |
Thallium54 |
D |
Jan. 6, 2021, 12:52 a.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
249 |
19763200 |
|
|
103410374 |
Kamfucius |
D |
Jan. 5, 2021, 3 p.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
249 |
20582400 |
|
|
103473045 |
TheOneYouWant |
D |
Jan. 5, 2021, 6:51 p.m. |
OK |
GNU C++17 (64) |
TESTS |
44 |
249 |
20684800 |
|
|
103448454 |
uwi |
D |
Jan. 5, 2021, 4:07 p.m. |
OK |
Java 11 |
TESTS |
44 |
405 |
15155200 |
|
|
103456140 |
mikit |
D |
Jan. 5, 2021, 4:24 p.m. |
OK |
Java 11 |
TESTS |
44 |
639 |
42393600 |
|
|
103441131 |
insert_cool_handle |
D |
Jan. 5, 2021, 3:51 p.m. |
OK |
Java 11 |
TESTS |
44 |
794 |
63795200 |
|
|
103488817 |
Agnimandur |
D |
Jan. 5, 2021, 11:53 p.m. |
OK |
Java 11 |
TESTS |
44 |
967 |
74956800 |
|
|
103453389 |
mphillotry |
D |
Jan. 5, 2021, 4:18 p.m. |
OK |
Java 11 |
TESTS |
44 |
997 |
52940800 |
|
|
103473168 |
fetetriste |
D |
Jan. 5, 2021, 6:53 p.m. |
OK |
Java 8 |
TESTS |
44 |
358 |
12185600 |
|
|
103445421 |
dalt |
D |
Jan. 5, 2021, 4 p.m. |
OK |
Java 8 |
TESTS |
44 |
701 |
71884800 |
|
|
103479928 |
Whiplash99 |
D |
Jan. 5, 2021, 8:19 p.m. |
OK |
Java 8 |
TESTS |
44 |
780 |
76492800 |
|
|
103483621 |
kareem3id |
D |
Jan. 5, 2021, 9:28 p.m. |
OK |
Java 8 |
TESTS |
44 |
920 |
68812800 |
|
|
103460248 |
KharYusuf |
D |
Jan. 5, 2021, 4:33 p.m. |
OK |
Java 8 |
TESTS |
44 |
982 |
71577600 |
|
|
103474464 |
polyakoff |
D |
Jan. 5, 2021, 7:06 p.m. |
OK |
Java 8 |
TESTS |
44 |
997 |
67481600 |
|
|
103479734 |
Whiplash99 |
D |
Jan. 5, 2021, 8:16 p.m. |
OK |
Java 8 |
TESTS |
44 |
998 |
76595200 |
|
|
103460669 |
ZerooCool |
D |
Jan. 5, 2021, 4:33 p.m. |
OK |
Java 8 |
TESTS |
44 |
998 |
88268800 |
|
|
103456743 |
Tlatoani |
D |
Jan. 5, 2021, 4:26 p.m. |
OK |
Kotlin |
TESTS |
44 |
701 |
47513600 |
|
|
103489425 |
CepGamer |
D |
Jan. 6, 2021, 12:13 a.m. |
OK |
Kotlin |
TESTS |
44 |
810 |
73011200 |
|
|
103489314 |
CepGamer |
D |
Jan. 6, 2021, 12:09 a.m. |
OK |
Kotlin |
TESTS |
44 |
998 |
104755200 |
|
|
103488909 |
CepGamer |
D |
Jan. 5, 2021, 11:56 p.m. |
OK |
Kotlin |
TESTS |
44 |
998 |
105267200 |
|
|
103489092 |
CepGamer |
D |
Jan. 6, 2021, 12:02 a.m. |
OK |
Kotlin |
TESTS |
44 |
998 |
105267200 |
|
|
103455138 |
pichulia |
D |
Jan. 5, 2021, 4:22 p.m. |
OK |
MS C++ 2017 |
TESTS |
44 |
389 |
18636800 |
|
|
103453330 |
keymoon |
D |
Jan. 5, 2021, 4:18 p.m. |
OK |
.NET Core C# |
TESTS |
44 |
733 |
44748800 |
|
|
103457660 |
azukun |
D |
Jan. 5, 2021, 4:28 p.m. |
OK |
.NET Core C# |
TESTS |
44 |
842 |
49561600 |
|
|
103436919 |
conqueror_of_tourist |
D |
Jan. 5, 2021, 3:43 p.m. |
OK |
PyPy 3 |
TESTS |
44 |
779 |
45056000 |
|
|
103490469 |
marroncastle |
D |
Jan. 6, 2021, 12:47 a.m. |
OK |
PyPy 3 |
TESTS |
44 |
795 |
46796800 |
|
|
103456502 |
pineriver |
D |
Jan. 5, 2021, 4:25 p.m. |
OK |
PyPy 3 |
TESTS |
44 |
811 |
63692800 |
|
|
103490540 |
marroncastle |
D |
Jan. 6, 2021, 12:49 a.m. |
OK |
PyPy 3 |
TESTS |
44 |
873 |
42905600 |
|
|
103437631 |
titia |
D |
Jan. 5, 2021, 3:44 p.m. |
OK |
PyPy 3 |
TESTS |
44 |
919 |
45158400 |
|
|
103484572 |
at_f |
D |
Jan. 5, 2021, 9:50 p.m. |
OK |
PyPy 3 |
TESTS |
44 |
920 |
84889600 |
|
|
103456513 |
chinerist |
D |
Jan. 5, 2021, 4:25 p.m. |
OK |
PyPy 3 |
TESTS |
44 |
935 |
42496000 |
|
|
103473120 |
jimm89 |
D |
Jan. 5, 2021, 6:52 p.m. |
OK |
PyPy 3 |
TESTS |
44 |
967 |
86118400 |
|
|
103447200 |
sansen |
D |
Jan. 5, 2021, 4:04 p.m. |
OK |
Rust |
TESTS |
44 |
233 |
27545600 |
|
|
remove filters
Back to search problems