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'Dima the hamster enjoys nibbling different things: cages, sticks, bad problemsetters and even trees! Recently he found a binary search tree and instinctively nibbled all of its edges, hence messing up the vertices. Dima knows that if Andrew, who has been thoroughly assembling the tree for a long time, comes home and sees his creation demolished, he 'll get extremely upset. To not let that happen, Dima has to recover the binary search tree. Luckily, he noticed that any two vertices connected by a direct edge had their greatest common divisor value exceed 1 . Help Dima construct such a binary search tree or determine that it 's impossible. The definition and properties of a binary search tree can be found here. The first line contains the number of vertices n ( 2 <= n <= 700 ). The second line features n distinct integers a_i ( 2 <= a_i <= 10^9 ) -- the values of vertices in ascending order. If it is possible to reassemble the binary search tree, such that the greatest common divisor of any two vertices connected by the edge is greater than 1 , print "Yes" (quotes for clarity). Otherwise, print "No" (quotes for clarity). The picture below illustrates one of the possible trees for the first example. The picture below illustrates one of the possible trees for the third example. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
64457123 |
hos.lyric |
D |
Nov. 7, 2019, 9:05 a.m. |
OK |
D |
TESTS |
81 |
373 |
11878400 |
|
2000 |
41939172 |
FlyNN67 |
D |
Aug. 21, 2018, 2:24 p.m. |
OK |
FPC |
TESTS |
81 |
966 |
1536000 |
|
2000 |
41894115 |
newbieski |
D |
Aug. 20, 2018, 8:33 a.m. |
OK |
GNU C |
TESTS |
78 |
93 |
2560000 |
|
2000 |
41894210 |
newbieski |
D |
Aug. 20, 2018, 8:36 a.m. |
OK |
GNU C |
TESTS |
78 |
358 |
1433600 |
|
2000 |
41915519 |
Ezio07 |
D |
Aug. 20, 2018, 9:04 p.m. |
OK |
GNU C |
TESTS |
81 |
405 |
5939200 |
|
2000 |
42350800 |
AotoriChiaki |
D |
Sept. 2, 2018, 5 a.m. |
OK |
GNU C++ |
TESTS |
81 |
46 |
4505600 |
|
2000 |
41907770 |
2016wudi |
D |
Aug. 20, 2018, 3:37 p.m. |
OK |
GNU C++ |
TESTS |
78 |
61 |
4300800 |
|
2000 |
42143736 |
xxjAc |
D |
Aug. 27, 2018, 7:32 a.m. |
OK |
GNU C++ |
TESTS |
81 |
61 |
4505600 |
|
2000 |
42305002 |
daifucong |
D |
Aug. 31, 2018, 10:33 a.m. |
OK |
GNU C++ |
TESTS |
81 |
62 |
4096000 |
|
2000 |
42305561 |
daifucong |
D |
Aug. 31, 2018, 10:59 a.m. |
OK |
GNU C++ |
TESTS |
81 |
62 |
4096000 |
|
2000 |
41879986 |
Milk_Acid |
D |
Aug. 20, 2018, 12:49 a.m. |
OK |
GNU C++ |
TESTS |
78 |
62 |
6758400 |
|
2000 |
41909410 |
MakiseKurisu004 |
D |
Aug. 20, 2018, 4:41 p.m. |
OK |
GNU C++ |
TESTS |
78 |
62 |
10035200 |
|
2000 |
41882542 |
AAYES |
D |
Aug. 20, 2018, 2:11 a.m. |
OK |
GNU C++ |
TESTS |
78 |
62 |
10342400 |
|
2000 |
41998205 |
byh |
D |
Aug. 23, 2018, 1:24 p.m. |
OK |
GNU C++ |
TESTS |
81 |
77 |
7372800 |
|
2000 |
41884678 |
hello_word_cai |
D |
Aug. 20, 2018, 2:53 a.m. |
OK |
GNU C++ |
TESTS |
78 |
77 |
12902400 |
|
2000 |
42106208 |
tall15421542 |
D |
Aug. 26, 2018, 12:59 a.m. |
OK |
GNU C11 |
TESTS |
81 |
62 |
5939200 |
|
2000 |
41874430 |
BaZ_ |
D |
Aug. 19, 2018, 7:58 p.m. |
OK |
GNU C11 |
TESTS |
78 |
77 |
24166400 |
|
2000 |
47332518 |
ACFirst |
D |
Dec. 21, 2018, 1:35 p.m. |
OK |
GNU C11 |
TESTS |
81 |
249 |
6041600 |
|
2000 |
57306397 |
sansen |
D |
July 19, 2019, 4:06 a.m. |
OK |
GNU C11 |
TESTS |
81 |
405 |
1536000 |
|
2000 |
41869905 |
lordoz |
D |
Aug. 19, 2018, 6:05 p.m. |
OK |
GNU C++11 |
TESTS |
76 |
31 |
0 |
|
2000 |
41895859 |
xyzzxy |
D |
Aug. 20, 2018, 9:26 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
46 |
2355200 |
|
2000 |
41904519 |
fzzsl |
D |
Aug. 20, 2018, 1:53 p.m. |
OK |
GNU C++11 |
TESTS |
78 |
46 |
2560000 |
|
2000 |
41885349 |
Luffbee |
D |
Aug. 20, 2018, 3:17 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
46 |
3276800 |
|
2000 |
41925167 |
TheDude__ |
D |
Aug. 21, 2018, 7:06 a.m. |
OK |
GNU C++11 |
TESTS |
81 |
46 |
3481600 |
|
2000 |
41974314 |
piglovely2205 |
D |
Aug. 22, 2018, 5:26 p.m. |
OK |
GNU C++11 |
TESTS |
81 |
46 |
6144000 |
|
2000 |
41858225 |
Rebirth_A |
D |
Aug. 19, 2018, 3:13 p.m. |
OK |
GNU C++11 |
TESTS |
76 |
46 |
10137600 |
|
2000 |
43183508 |
vjudge5 |
D |
Sept. 21, 2018, 2:24 p.m. |
OK |
GNU C++11 |
TESTS |
81 |
61 |
1536000 |
|
2000 |
41879374 |
niquefa_diego |
D |
Aug. 20, 2018, 12:15 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
61 |
2355200 |
|
2000 |
44301233 |
vjudge3 |
D |
Oct. 14, 2018, 10:42 a.m. |
OK |
GNU C++11 |
TESTS |
81 |
61 |
2560000 |
|
2000 |
41872199 |
brandonzhang |
D |
Aug. 19, 2018, 6:51 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
1536000 |
|
2000 |
41959043 |
wzw19991105 |
D |
Aug. 22, 2018, 8:23 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
46 |
2560000 |
|
2000 |
41880226 |
crasysky |
D |
Aug. 20, 2018, 12:59 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
4505600 |
|
2000 |
41948796 |
asfd221 |
D |
Aug. 21, 2018, 9:35 p.m. |
OK |
GNU C++14 |
TESTS |
81 |
46 |
4505600 |
|
2000 |
41886534 |
wiwitrifai |
D |
Aug. 20, 2018, 4:14 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
4608000 |
|
2000 |
41873805 |
black_grape |
D |
Aug. 19, 2018, 7:39 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
5939200 |
|
2000 |
41968222 |
Mr_Emrul |
D |
Aug. 22, 2018, 1:30 p.m. |
OK |
GNU C++14 |
TESTS |
81 |
46 |
6144000 |
|
2000 |
41870556 |
JustasZ |
D |
Aug. 19, 2018, 6:19 p.m. |
OK |
GNU C++14 |
TESTS |
76 |
46 |
6144000 |
|
2000 |
41869813 |
JustasZ |
D |
Aug. 19, 2018, 6:03 p.m. |
OK |
GNU C++14 |
TESTS |
76 |
46 |
6144000 |
|
2000 |
41907482 |
Lych4o_ |
D |
Aug. 20, 2018, 3:27 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
6144000 |
|
2000 |
41941859 |
sjc061031 |
D |
Aug. 21, 2018, 3:59 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
46 |
1843200 |
|
2000 |
42881855 |
vjudge5 |
D |
Sept. 15, 2018, 7:25 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
46 |
2560000 |
|
2000 |
42881830 |
swust5120177231 |
D |
Sept. 15, 2018, 7:24 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
46 |
2560000 |
|
2000 |
42880403 |
vjudge5 |
D |
Sept. 15, 2018, 6:24 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
46 |
2560000 |
|
2000 |
42310460 |
vjudge5 |
D |
Aug. 31, 2018, 1:58 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
46 |
2764800 |
|
2000 |
41884725 |
gorogoro |
D |
Aug. 20, 2018, 2:54 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
3481600 |
|
2000 |
41860669 |
Counting_Stars |
D |
Aug. 19, 2018, 3:27 p.m. |
OK |
GNU C++17 |
TESTS |
76 |
46 |
4505600 |
|
2000 |
41872635 |
kongroo |
D |
Aug. 19, 2018, 7:02 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
6041600 |
|
2000 |
41909687 |
fsociety00 |
D |
Aug. 20, 2018, 4:53 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
6144000 |
|
2000 |
41961589 |
Jmokut |
D |
Aug. 22, 2018, 9:45 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
46 |
9011200 |
|
2000 |
41874407 |
BaZ_ |
D |
Aug. 19, 2018, 7:57 p.m. |
OK |
Java 8 |
TESTS |
78 |
170 |
0 |
|
2000 |
41898113 |
Ahmad |
D |
Aug. 20, 2018, 10:42 a.m. |
OK |
Java 8 |
TESTS |
78 |
187 |
0 |
|
2000 |
42005137 |
saichandu6 |
D |
Aug. 23, 2018, 5:52 p.m. |
OK |
Java 8 |
TESTS |
81 |
202 |
0 |
|
2000 |
69008630 |
NewOneAgain |
D |
Jan. 18, 2020, 2:03 a.m. |
OK |
Java 8 |
TESTS |
81 |
202 |
0 |
|
2000 |
69008215 |
Rajkin_Hossain |
D |
Jan. 18, 2020, 1:48 a.m. |
OK |
Java 8 |
TESTS |
81 |
202 |
0 |
|
2000 |
41874328 |
BaZ_ |
D |
Aug. 19, 2018, 7:56 p.m. |
OK |
Java 8 |
TESTS |
78 |
202 |
0 |
|
2000 |
44834488 |
donli |
D |
Oct. 25, 2018, 10:09 a.m. |
OK |
Java 8 |
TESTS |
81 |
217 |
0 |
|
2000 |
41918170 |
I_love_Harpae |
D |
Aug. 21, 2018, 1:19 a.m. |
OK |
Java 8 |
TESTS |
81 |
248 |
0 |
|
2000 |
41866639 |
Derino |
D |
Aug. 19, 2018, 5:19 p.m. |
OK |
Java 8 |
TESTS |
76 |
249 |
9420800 |
|
2000 |
41861026 |
xodiac |
D |
Aug. 19, 2018, 3:29 p.m. |
OK |
Java 8 |
TESTS |
76 |
264 |
16691200 |
|
2000 |
41892457 |
Slamur |
D |
Aug. 20, 2018, 7:49 a.m. |
OK |
Kotlin |
TESTS |
78 |
888 |
81100800 |
|
2000 |
44467100 |
vjudge2 |
D |
Oct. 18, 2018, 3:27 a.m. |
OK |
MS C++ |
TESTS |
81 |
77 |
4505600 |
|
2000 |
42238925 |
Stresshoover |
D |
Aug. 29, 2018, 11:24 a.m. |
OK |
MS C++ |
TESTS |
81 |
109 |
4812800 |
|
2000 |
43785667 |
vjudge5 |
D |
Oct. 4, 2018, 12:07 p.m. |
OK |
MS C++ |
TESTS |
81 |
202 |
2355200 |
|
2000 |
44394006 |
vjudge1 |
D |
Oct. 16, 2018, 9:50 a.m. |
OK |
MS C++ |
TESTS |
81 |
265 |
6041600 |
|
2000 |
69951531 |
vjudge3 |
D |
Feb. 1, 2020, 9:05 a.m. |
OK |
MS C++ |
TESTS |
81 |
280 |
1536000 |
|
2000 |
41958842 |
dimdem |
D |
Aug. 22, 2018, 8:17 a.m. |
OK |
MS C++ |
TESTS |
81 |
296 |
36864000 |
|
2000 |
69952622 |
vjudge1 |
D |
Feb. 1, 2020, 9:20 a.m. |
OK |
MS C++ |
TESTS |
81 |
358 |
1536000 |
|
2000 |
69936622 |
vjudge2 |
D |
Feb. 1, 2020, 4:10 a.m. |
OK |
MS C++ |
TESTS |
81 |
390 |
1536000 |
|
2000 |
42233895 |
vjudge3 |
D |
Aug. 29, 2018, 8:25 a.m. |
OK |
MS C++ |
TESTS |
81 |
452 |
12390400 |
|
2000 |
42115118 |
ys1468362286 |
D |
Aug. 26, 2018, 9:05 a.m. |
OK |
MS C++ |
TESTS |
81 |
467 |
10240000 |
|
2000 |
62686601 |
AleksanderBalobanov |
D |
Oct. 16, 2019, 2:14 p.m. |
OK |
MS C++ 2017 |
TESTS |
81 |
717 |
5120000 |
|
2000 |
41866885 |
pajenegod |
D |
Aug. 19, 2018, 5:21 p.m. |
OK |
PyPy 2 |
TESTS |
76 |
499 |
33996800 |
|
2000 |
42101181 |
wadissimo |
D |
Aug. 25, 2018, 7:21 p.m. |
OK |
PyPy 3 |
TESTS |
81 |
389 |
18329600 |
|
2000 |
61311945 |
sansen |
D |
Sept. 26, 2019, 9:36 a.m. |
OK |
Rust |
TESTS |
81 |
639 |
3174400 |
|
2000 |
remove filters
Back to search problems