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 with n vertices and m edges. Also, you are given an integer k . Find either a clique of size k or a non-empty subset of vertices such that each vertex of this subset has at least k neighbors in the subset. If there are no such cliques and subsets report about it. A subset of vertices is called a clique of size k if its size is k and there exists an edge between every two vertices from the subset. A vertex is called a neighbor of the other vertex if there exists an edge between them. The first line contains a single integer t ( 1 <= q t <= q 10^5 ) -- the number of test cases. The next lines contain descriptions of test cases. The first line of the description of each test case contains three integers n , m , k ( 1 <= q n, m, k <= q 10^5 , k <= q n ). Each of the next m lines contains two integers u, v (1 <= q u, v <= q n, u neq v) , denoting an edge between vertices u and v . It is guaranteed that there are no self-loops or multiple edges. It is guaranteed that the sum of n for all test cases and the sum of m for all test cases does not exceed 2 cdot 10^5 . For each test case: If you found a subset of vertices such that each vertex of this subset has at least k neighbors in the subset in the first line output 1 and the size of the subset. On the second line output the vertices of the subset in any order. If you found a clique of size k then in the first line output 2 and in the second line output the vertices of the clique in any order. If there are no required subsets and cliques print -1 . If there exists multiple possible answers you can print any of them. In the first test case: the subset {1, 2, 3, 4 } is a clique of size 4 . In the second test case: degree of each vertex in the original graph is at least 3 . So the set of all vertices is a correct '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
98719658 |
starusc |
B |
Nov. 17, 2020, 3:48 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
202 |
7475200 |
|
|
98765466 |
18380120126 |
B |
Nov. 18, 2020, 12:40 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
311 |
8396800 |
|
|
98762649 |
Lius |
B |
Nov. 17, 2020, 10:17 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
311 |
9523200 |
|
|
98733481 |
AmShZ |
B |
Nov. 17, 2020, 4:25 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
311 |
11673600 |
|
|
98710471 |
jiangIy |
B |
Nov. 17, 2020, 3:24 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
327 |
8704000 |
|
|
98764957 |
White-House |
B |
Nov. 18, 2020, 12:16 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
374 |
23756800 |
|
|
98772730 |
Pengzhike |
B |
Nov. 18, 2020, 4:18 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
420 |
15462400 |
|
|
98734426 |
emofunc |
B |
Nov. 17, 2020, 4:28 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
421 |
29798400 |
|
|
98750546 |
yenuj |
B |
Nov. 17, 2020, 5:55 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
436 |
6451200 |
|
|
98765286 |
gmh77 |
B |
Nov. 18, 2020, 12:31 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
436 |
85401600 |
|
|
98767263 |
Xtale_cross |
B |
Nov. 18, 2020, 1:57 a.m. |
OK |
GNU C++14 |
TESTS |
58 |
280 |
25600000 |
|
|
98709794 |
receed |
B |
Nov. 17, 2020, 3:22 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
280 |
40857600 |
|
|
98731833 |
pikmike |
B |
Nov. 17, 2020, 4:21 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
342 |
6860800 |
|
|
98764984 |
antguz |
B |
Nov. 18, 2020, 12:17 a.m. |
OK |
GNU C++14 |
TESTS |
58 |
373 |
7168000 |
|
|
98708106 |
orz |
B |
Nov. 17, 2020, 3:18 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
374 |
13209600 |
|
|
98749034 |
KhaustovPavel |
B |
Nov. 17, 2020, 5:41 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
405 |
6758400 |
|
|
98721686 |
BlueDiamond |
B |
Nov. 17, 2020, 3:54 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
436 |
9318400 |
|
|
98743384 |
marcOS |
B |
Nov. 17, 2020, 4:48 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
451 |
13619200 |
|
|
98747076 |
adurysk |
B |
Nov. 17, 2020, 5:26 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
467 |
12697600 |
|
|
98765021 |
antguz |
B |
Nov. 18, 2020, 12:19 a.m. |
OK |
GNU C++14 |
TESTS |
58 |
468 |
7168000 |
|
|
98752408 |
tempura0224 |
B |
Nov. 17, 2020, 6:18 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
124 |
8601600 |
|
|
98721755 |
SirShokoladina |
B |
Nov. 17, 2020, 3:54 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
187 |
8294400 |
|
|
98712846 |
zemen |
B |
Nov. 17, 2020, 3:30 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
202 |
7475200 |
|
|
98718420 |
TeaPot |
B |
Nov. 17, 2020, 3:45 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
202 |
8499200 |
|
|
98743780 |
_h_ |
B |
Nov. 17, 2020, 4:49 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
202 |
10240000 |
|
|
98759467 |
Vimmer |
B |
Nov. 17, 2020, 8:28 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
202 |
10752000 |
|
|
98712998 |
Mahsa.rf |
B |
Nov. 17, 2020, 3:30 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
202 |
13619200 |
|
|
98759253 |
igoroogle |
B |
Nov. 17, 2020, 8:23 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
233 |
11366400 |
|
|
98764503 |
lukkka |
B |
Nov. 17, 2020, 11:52 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
233 |
16179200 |
|
|
98764614 |
lukkka |
B |
Nov. 17, 2020, 11:58 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
234 |
16179200 |
|
|
98734043 |
Devil |
B |
Nov. 17, 2020, 4:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
124 |
5734400 |
|
|
98741521 |
tfg |
B |
Nov. 17, 2020, 4:45 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
124 |
8396800 |
|
|
98763887 |
KKT_89 |
B |
Nov. 17, 2020, 11:18 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
124 |
12390400 |
|
|
98713484 |
Xellos |
B |
Nov. 17, 2020, 3:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
140 |
12902400 |
|
|
98722205 |
AndreySergunin |
B |
Nov. 17, 2020, 3:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
187 |
11980800 |
|
|
98739979 |
_Ash__ |
B |
Nov. 17, 2020, 4:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
187 |
12083200 |
|
|
98753206 |
_Ash__ |
B |
Nov. 17, 2020, 6:29 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
187 |
12390400 |
|
|
98716016 |
Nebuchadnezzar |
B |
Nov. 17, 2020, 3:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
249 |
37376000 |
|
|
98704771 |
ecnerwala |
B |
Nov. 17, 2020, 3:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
264 |
30515200 |
|
|
98758166 |
jupiro |
B |
Nov. 17, 2020, 7:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
265 |
6553600 |
|
|
98718874 |
uwi |
B |
Nov. 17, 2020, 3:46 p.m. |
OK |
Java 11 |
TESTS |
58 |
545 |
3993600 |
|
|
98763729 |
AryssonFigueiredo |
B |
Nov. 17, 2020, 11:10 p.m. |
OK |
Java 8 |
TESTS |
58 |
764 |
20172800 |
|
|
98763875 |
AryssonFigueiredo |
B |
Nov. 17, 2020, 11:17 p.m. |
OK |
Java 8 |
TESTS |
58 |
779 |
20172800 |
|
|
98759842 |
AryssonFigueiredo |
B |
Nov. 17, 2020, 8:37 p.m. |
OK |
Java 8 |
TESTS |
58 |
779 |
20480000 |
|
|
98759412 |
AryssonFigueiredo |
B |
Nov. 17, 2020, 8:27 p.m. |
OK |
Java 8 |
TESTS |
58 |
826 |
20480000 |
|
|
98762729 |
AryssonFigueiredo |
B |
Nov. 17, 2020, 10:21 p.m. |
OK |
Java 8 |
TESTS |
58 |
841 |
20275200 |
|
|
98721872 |
cwise |
B |
Nov. 17, 2020, 3:54 p.m. |
OK |
Java 8 |
TESTS |
58 |
951 |
22528000 |
|
|
98770148 |
godxpunk |
B |
Nov. 18, 2020, 3:19 a.m. |
OK |
Java 8 |
TESTS |
58 |
998 |
39731200 |
|
|
98763976 |
AryssonFigueiredo |
B |
Nov. 17, 2020, 11:23 p.m. |
OK |
Kotlin |
TESTS |
58 |
779 |
21504000 |
|
|
98747593 |
pichulia |
B |
Nov. 17, 2020, 5:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
58 |
452 |
53452800 |
|
|
98741186 |
AnnSuperstar |
B |
Nov. 17, 2020, 4:44 p.m. |
OK |
MS C++ 2017 |
TESTS |
58 |
998 |
29491200 |
|
|
98725131 |
keymoon |
B |
Nov. 17, 2020, 4:03 p.m. |
OK |
.NET Core C# |
TESTS |
58 |
499 |
44953600 |
|
|
98744081 |
azukun |
B |
Nov. 17, 2020, 4:49 p.m. |
OK |
.NET Core C# |
TESTS |
58 |
530 |
44646400 |
|
|
98719450 |
sansen |
B |
Nov. 17, 2020, 3:48 p.m. |
OK |
Rust |
TESTS |
58 |
561 |
12902400 |
|
|
98749330 |
kobae964 |
B |
Nov. 17, 2020, 5:43 p.m. |
OK |
Rust |
TESTS |
58 |
982 |
12083200 |
|
|
98738074 |
ngtkana |
B |
Nov. 17, 2020, 4:37 p.m. |
OK |
Rust |
TESTS |
58 |
982 |
13824000 |
|
|
98711545 |
kobae964 |
B |
Nov. 17, 2020, 3:27 p.m. |
OK |
Rust |
TESTS |
58 |
997 |
12185600 |
|
|
remove filters
Back to search problems