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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
1148
|
Codeforces Global Round 3 |
FINISHED |
False |
8100 |
178298697 |
June 1, 2019, 2:35 p.m. |
Problems
B"Consider an undirected graph G with n vertices. There is a value a_i in each vertex. Two vertices i and j are connected with an edge if and only if gcd(a_i, a_j) > 1 , where gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y . Consider a set of vertices. Let's call a vertex in this set fair if it is connected with an edge with all other vertices in this set. You need to find a set of k vertices (where k is a given integer, 2 cdot k <= n ) where all vertices are fair or all vertices are not fair. One can show that such a set always exists. The first line contains integers n and k ( 6 <= q 2 cdot k <= q n <= q 10^5 ) -- the number of vertices and parameter k . The second line contains n integers a_1, a_2, ldots, a_n ( 2 <= a_i <= 10^7 ) -- the values in the vertices. Print exactly k distinct integers -- the indices of the vertices in the chosen set in any order. In the first test case, set {2, 4, 5 } is an example of set where no vertices are fair. The vertex 2 does not share an edge with vertex 4 since gcd(15, 8) = 1 . The vertex 4 does not share an edge with vertex 2 . The vertex 5 does not share an edge with vertex 2 . In the second test case, set {8, 5, 6, 4 } is an example of a set where all vertices are fair. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
64258834 |
2016wudi |
G |
Nov. 4, 2019, 3:52 p.m. |
OK |
GNU C++11 |
TESTS |
159 |
78 |
2252800 |
|
3100 |
59836442 |
_twilight |
G |
Sept. 1, 2019, 4:30 a.m. |
OK |
GNU C++11 |
TESTS |
159 |
405 |
217497600 |
|
3100 |
59835809 |
_twilight |
G |
Sept. 1, 2019, 3:57 a.m. |
OK |
GNU C++11 |
TESTS |
159 |
451 |
217497600 |
|
3100 |
57353905 |
ffffxk |
G |
July 20, 2019, 5:19 a.m. |
OK |
GNU C++11 |
TESTS |
159 |
545 |
190668800 |
|
3100 |
59529810 |
AloneKnight |
G |
Aug. 26, 2019, 2:36 p.m. |
OK |
GNU C++11 |
TESTS |
159 |
561 |
197324800 |
|
3100 |
60051019 |
frodakcin |
G |
Sept. 5, 2019, 12:30 a.m. |
OK |
GNU C++11 |
TESTS |
159 |
576 |
134144000 |
|
3100 |
56064294 |
shanxizeng |
G |
June 26, 2019, 7:08 a.m. |
OK |
GNU C++11 |
TESTS |
159 |
639 |
197324800 |
|
3100 |
54965262 |
dream__catcher |
G |
June 2, 2019, 6:08 a.m. |
OK |
GNU C++11 |
TESTS |
157 |
639 |
246374400 |
|
3100 |
54965754 |
dream__catcher |
G |
June 2, 2019, 6:21 a.m. |
OK |
GNU C++11 |
TESTS |
157 |
639 |
315699200 |
|
3100 |
54965556 |
lzoilxy |
G |
June 2, 2019, 6:16 a.m. |
OK |
GNU C++11 |
TESTS |
157 |
639 |
315699200 |
|
3100 |
55113934 |
gtrhetr |
G |
June 5, 2019, 7:45 a.m. |
OK |
GNU C++14 |
TESTS |
159 |
436 |
319590400 |
|
3100 |
55610334 |
ReaLNero1 |
G |
June 16, 2019, 5:16 a.m. |
OK |
GNU C++14 |
TESTS |
159 |
498 |
319590400 |
|
3100 |
54947522 |
Alex_2oo8 |
G |
June 1, 2019, 4:49 p.m. |
OK |
GNU C++14 |
TESTS |
157 |
529 |
186060800 |
|
3100 |
55082403 |
zsyzsy |
G |
June 4, 2019, 11:16 a.m. |
OK |
GNU C++14 |
TESTS |
159 |
529 |
232652800 |
|
3100 |
61981063 |
Scut82 |
G |
Oct. 6, 2019, 12:03 p.m. |
OK |
GNU C++14 |
TESTS |
159 |
545 |
186060800 |
|
3100 |
54949229 |
ATS |
G |
June 1, 2019, 6:39 p.m. |
OK |
GNU C++14 |
TESTS |
157 |
623 |
156262400 |
|
3100 |
55065169 |
newbiegcz |
G |
June 4, 2019, 3:01 a.m. |
OK |
GNU C++14 |
TESTS |
159 |
623 |
219955200 |
|
3100 |
55172255 |
krijgertje |
G |
June 5, 2019, 5:18 p.m. |
OK |
GNU C++14 |
TESTS |
159 |
701 |
87142400 |
|
3100 |
54970368 |
AghaTizi |
G |
June 2, 2019, 8:20 a.m. |
OK |
GNU C++14 |
TESTS |
157 |
748 |
97996800 |
|
3100 |
54970317 |
HanaElhami |
G |
June 2, 2019, 8:19 a.m. |
OK |
GNU C++14 |
TESTS |
157 |
748 |
97996800 |
|
3100 |
58970396 |
-Morass- |
G |
Aug. 17, 2019, 8:04 p.m. |
OK |
GNU C++17 |
TESTS |
159 |
171 |
87244800 |
|
3100 |
66247490 |
Xellos |
G |
Dec. 3, 2019, 9:37 p.m. |
OK |
GNU C++17 |
TESTS |
159 |
405 |
207462400 |
|
3100 |
55237148 |
whzzt |
G |
June 7, 2019, 9 a.m. |
OK |
GNU C++17 |
TESTS |
159 |
670 |
180633600 |
|
3100 |
54973406 |
WuK |
G |
June 2, 2019, 9:36 a.m. |
OK |
GNU C++17 |
TESTS |
157 |
732 |
4505600 |
|
3100 |
54945856 |
gisp_zjz |
G |
June 1, 2019, 4:43 p.m. |
OK |
GNU C++17 |
TESTS |
157 |
732 |
246579200 |
|
3100 |
55088194 |
tEMMIE.w. |
G |
June 4, 2019, 1:24 p.m. |
OK |
GNU C++17 |
TESTS |
159 |
732 |
306585600 |
|
3100 |
54972721 |
WuK |
G |
June 2, 2019, 9:19 a.m. |
OK |
GNU C++17 |
TESTS |
157 |
733 |
3686400 |
|
3100 |
54971979 |
WuK |
G |
June 2, 2019, 8:59 a.m. |
OK |
GNU C++17 |
TESTS |
157 |
733 |
4300800 |
|
3100 |
55015490 |
Lost |
G |
June 3, 2019, 12:08 p.m. |
OK |
GNU C++17 |
TESTS |
159 |
748 |
98304000 |
|
3100 |
54951799 |
gRaphael |
G |
June 1, 2019, 7:31 p.m. |
OK |
GNU C++17 |
TESTS |
157 |
764 |
7782400 |
|
3100 |
54946574 |
Petr |
G |
June 1, 2019, 4:46 p.m. |
OK |
Java 8 |
TESTS |
157 |
374 |
116633600 |
|
3100 |
58629369 |
happybelly |
G |
Aug. 11, 2019, 6:58 p.m. |
OK |
Java 8 |
TESTS |
159 |
623 |
87756800 |
|
3100 |
58569369 |
happybelly |
G |
Aug. 11, 2019, 9:23 a.m. |
OK |
Java 8 |
TESTS |
159 |
920 |
129228800 |
|
3100 |
58569716 |
happybelly |
G |
Aug. 11, 2019, 9:33 a.m. |
OK |
Java 8 |
TESTS |
159 |
935 |
129228800 |
|
3100 |
remove filters
Back to search problems