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'Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of n integers a_i . It is allowed to select any subset of them, and the score is equal to the greatest common divisor of selected elements. The goal is to take as little elements as it is possible, getting the score 1 . Now Janusz wonders, for given sequence, how much elements should the player choose? The first line contains an only integer n ( 1 <= n <= 300 ,000 ) -- the number of integers in the sequence. The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 300 ,000 ). If there is no subset of the given sequence with gcd equal to 1 , output -1. Otherwise, output exactly one integer -- the size of the smallest subset with gcd equal to 1 . In the first example, selecting a subset of all numbers gives a gcd of 1 and for all smaller subsets the gcd is greater than 1 . In the second example, for all subsets of numbers the gcd is at least 2 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
45032931 |
xsc |
F |
Oct. 29, 2018, 5:43 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
68 |
249 |
7577600 |
|
2500 |
45195333 |
BumbleBee |
F |
Nov. 2, 2018, 6:31 a.m. |
OK |
GNU C11 |
TESTS |
68 |
234 |
34816000 |
|
2500 |
45022529 |
sgtlaugh |
F |
Oct. 28, 2018, 7:43 p.m. |
OK |
GNU C11 |
TESTS |
68 |
2214 |
5427200 |
|
2500 |
45480062 |
syxakioi |
F |
Nov. 9, 2018, 2:21 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45479913 |
syxakioi |
F |
Nov. 9, 2018, 2:17 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45479699 |
syxakioi |
F |
Nov. 9, 2018, 2:10 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45479657 |
syxakioi |
F |
Nov. 9, 2018, 2:09 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45479588 |
syxakioi |
F |
Nov. 9, 2018, 2:07 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45479504 |
syxakioi |
F |
Nov. 9, 2018, 2:04 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45032985 |
xsc |
F |
Oct. 29, 2018, 5:45 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45032885 |
xsc |
F |
Oct. 29, 2018, 5:41 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45480258 |
syxakioi |
F |
Nov. 9, 2018, 2:27 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45480331 |
syxakioi |
F |
Nov. 9, 2018, 2:29 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
46 |
6041600 |
|
2500 |
45132425 |
Origenes |
F |
Oct. 31, 2018, 10:58 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
93 |
5324800 |
|
2500 |
45016813 |
percywtc |
F |
Oct. 28, 2018, 5:18 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
93 |
5529600 |
|
2500 |
62238696 |
idxcalcal |
F |
Oct. 10, 2019, 12:21 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
93 |
29388800 |
|
2500 |
46018435 |
t0urlst |
F |
Nov. 21, 2018, 6:10 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
108 |
7577600 |
|
2500 |
45014827 |
Omar_Elawady |
F |
Oct. 28, 2018, 5:03 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
109 |
2969600 |
|
2500 |
45060925 |
dai |
F |
Oct. 29, 2018, 2:46 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
109 |
3584000 |
|
2500 |
45060886 |
dai |
F |
Oct. 29, 2018, 2:45 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
109 |
3584000 |
|
2500 |
47360531 |
vanbang9710 |
F |
Dec. 22, 2018, 8:29 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
109 |
4812800 |
|
2500 |
45052116 |
already_last |
F |
Oct. 29, 2018, 11:12 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
109 |
7270400 |
|
2500 |
46018960 |
t0urlst |
F |
Nov. 21, 2018, 6:35 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
109 |
7577600 |
|
2500 |
45028616 |
MrDindows |
F |
Oct. 29, 2018, 1:10 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
78 |
76902400 |
|
2500 |
45500554 |
azala |
F |
Nov. 10, 2018, 7:21 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
93 |
1024000 |
|
2500 |
45031326 |
FizzyDavid |
F |
Oct. 29, 2018, 4:16 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
93 |
5427200 |
|
2500 |
45028637 |
MrDindows |
F |
Oct. 29, 2018, 1:12 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
93 |
76902400 |
|
2500 |
45011791 |
FizzyDavid |
F |
Oct. 28, 2018, 4:43 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
108 |
5427200 |
|
2500 |
45084709 |
masonsbro |
F |
Oct. 30, 2018, 6:30 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
108 |
7475200 |
|
2500 |
45448586 |
Hassanosama |
F |
Nov. 8, 2018, 2:40 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
109 |
2252800 |
|
2500 |
45022165 |
cjtoribio |
F |
Oct. 28, 2018, 7:36 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
109 |
7884800 |
|
2500 |
45027985 |
T______________T |
F |
Oct. 29, 2018, 12:17 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
109 |
9523200 |
|
2500 |
45788278 |
llmxby |
F |
Nov. 16, 2018, 4:31 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
109 |
9932800 |
|
2500 |
45154883 |
Martynas |
F |
Oct. 31, 2018, 11:50 p.m. |
OK |
Go |
TESTS |
68 |
343 |
14950400 |
|
2500 |
45018923 |
eatmore |
F |
Oct. 28, 2018, 5:31 p.m. |
OK |
Java 8 |
TESTS |
68 |
218 |
4198400 |
|
2500 |
68716527 |
dalt |
F |
Jan. 13, 2020, 2:40 p.m. |
OK |
Java 8 |
TESTS |
68 |
218 |
51916800 |
|
2500 |
45026483 |
TheRaven |
F |
Oct. 28, 2018, 10:20 p.m. |
OK |
Java 8 |
TESTS |
68 |
233 |
0 |
|
2500 |
45014818 |
Lewin |
F |
Oct. 28, 2018, 5:03 p.m. |
OK |
Java 8 |
TESTS |
68 |
233 |
2252800 |
|
2500 |
68380304 |
Ahmad |
F |
Jan. 8, 2020, 12:03 a.m. |
OK |
Java 8 |
TESTS |
68 |
233 |
8601600 |
|
2500 |
45011870 |
uwi |
F |
Oct. 28, 2018, 4:43 p.m. |
OK |
Java 8 |
TESTS |
68 |
249 |
0 |
|
2500 |
69087109 |
dalt |
F |
Jan. 19, 2020, 8:44 a.m. |
OK |
Java 8 |
TESTS |
68 |
249 |
65740800 |
|
2500 |
45012312 |
VArtem |
F |
Oct. 28, 2018, 4:46 p.m. |
OK |
Java 8 |
TESTS |
68 |
296 |
4608000 |
|
2500 |
45257311 |
wadissimo |
F |
Nov. 3, 2018, 8:51 p.m. |
OK |
Java 8 |
TESTS |
68 |
312 |
46489600 |
|
2500 |
48416297 |
xodiac |
F |
Jan. 15, 2019, 10:37 a.m. |
OK |
Java 8 |
TESTS |
68 |
327 |
2969600 |
|
2500 |
45032921 |
xsc |
F |
Oct. 29, 2018, 5:42 a.m. |
OK |
MS C++ |
TESTS |
68 |
109 |
6041600 |
|
2500 |
45013924 |
wa1tz719 |
F |
Oct. 28, 2018, 4:57 p.m. |
OK |
MS C++ |
TESTS |
68 |
202 |
17510400 |
|
2500 |
45237923 |
wp32pw |
F |
Nov. 3, 2018, 10:17 a.m. |
OK |
MS C++ |
TESTS |
68 |
296 |
6348800 |
|
2500 |
45158944 |
vjudge2 |
F |
Nov. 1, 2018, 7:12 a.m. |
OK |
MS C++ |
TESTS |
68 |
1872 |
50483200 |
|
2500 |
57893272 |
yuanhaowei |
F |
July 28, 2019, 12:36 p.m. |
OK |
MS C++ 2017 |
TESTS |
68 |
623 |
11980800 |
|
2500 |
45435997 |
Mulx10 |
F |
Nov. 8, 2018, 7:59 a.m. |
OK |
PyPy 2 |
TESTS |
68 |
2386 |
93593600 |
|
2500 |
45436106 |
Mulx10 |
F |
Nov. 8, 2018, 8:03 a.m. |
OK |
PyPy 2 |
TESTS |
68 |
2480 |
83660800 |
|
2500 |
45496696 |
llbra8z |
F |
Nov. 10, 2018, 1:53 a.m. |
OK |
PyPy 2 |
TESTS |
68 |
2558 |
82329600 |
|
2500 |
45436168 |
Mulx10 |
F |
Nov. 8, 2018, 8:05 a.m. |
OK |
PyPy 2 |
TESTS |
68 |
2604 |
82432000 |
|
2500 |
47166188 |
gazaan |
F |
Dec. 17, 2018, 12:40 p.m. |
OK |
Scala |
TESTS |
68 |
764 |
34816000 |
|
2500 |
remove filters
Back to search problems