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"Yasin has an array a containing n integers. Yasin is a 5 year old, so he loves ultimate weird things. Yasin denotes weirdness of an array as maximum gcd(ai, xe2 x80 x89 xe2 x80 x89aj) value among all 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89i xe2 x80 x89< xe2 x80 x89j xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n. For n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x891 weirdness is equal to 0, gcd(x, xe2 x80 x89 xe2 x80 x89y) is the greatest common divisor of integers x and y. He also defines the ultimate weirdness of an array. Ultimate weirdness is where f(i, xe2 x80 x89 xe2 x80 x89j) is weirdness of the new array a obtained by removing all elements between i and j inclusive, so new array is [a1... ai xe2 x80 x89- xe2 x80 x891, xe2 x80 x89aj xe2 x80 x89+ xe2 x80 x891... an]. Since 5 year old boys can't code, Yasin asks for your help to find the value of ultimate weirdness of the given array a! The first line of the input contains a single integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89200 xe2 x80 x89000) -- the number of elements in a. The next line contains n integers ai (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89200 xe2 x80 x89000), where the i-th number is equal to the i-th element of the array a. It is guaranteed that all ai are distinct. Print a single line containing the value of ultimate weirdness of the array a. Consider the first sample. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
17970938 |
pegasas |
C |
May 17, 2016, 5:29 p.m. |
OK |
GNU C++ |
TESTS |
57 |
77 |
34304000 |
|
2700 |
17880799 |
abeker |
C |
May 12, 2016, 7:15 p.m. |
OK |
GNU C++ |
TESTS |
57 |
155 |
11264000 |
|
2700 |
17876720 |
wtw |
C |
May 12, 2016, 1:51 p.m. |
OK |
GNU C++ |
TESTS |
57 |
171 |
11059200 |
|
2700 |
19423343 |
bukefala |
C |
July 26, 2016, 1:15 p.m. |
OK |
GNU C++ |
TESTS |
57 |
171 |
11571200 |
|
2700 |
17880769 |
abeker |
C |
May 12, 2016, 7:13 p.m. |
OK |
GNU C++ |
TESTS |
57 |
187 |
11264000 |
|
2700 |
33453169 |
Blue233333 |
C |
Dec. 20, 2017, 11:04 a.m. |
OK |
GNU C++ |
TESTS |
57 |
187 |
43520000 |
|
2700 |
18502019 |
Owaski |
C |
June 15, 2016, 4:23 p.m. |
OK |
GNU C++ |
TESTS |
57 |
218 |
23040000 |
|
2700 |
17905354 |
skyxuan |
C |
May 14, 2016, 12:31 p.m. |
OK |
GNU C++ |
TESTS |
57 |
233 |
4505600 |
|
2700 |
18003213 |
ws_fqk |
C |
May 20, 2016, 10:41 a.m. |
OK |
GNU C++ |
TESTS |
57 |
234 |
30310400 |
|
2700 |
18710639 |
assassain |
C |
June 24, 2016, 10:17 p.m. |
OK |
GNU C++ |
TESTS |
57 |
249 |
20684800 |
|
2700 |
40984476 |
ReaLNero1 |
C |
July 30, 2018, 7:24 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
78 |
31846400 |
|
2700 |
50306733 |
vjudge2 |
C |
Feb. 22, 2019, 6:38 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
78 |
124313600 |
|
2700 |
50306662 |
vjudge1 |
C |
Feb. 22, 2019, 6:35 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
78 |
124313600 |
|
2700 |
21131416 |
zhaozilong |
C |
Oct. 3, 2016, 8:24 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
93 |
32153600 |
|
2700 |
17885146 |
xuruifan |
C |
May 13, 2016, 7:25 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
93 |
34099200 |
|
2700 |
17979718 |
bshu |
C |
May 18, 2016, 12:40 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
93 |
41472000 |
|
2700 |
17861505 |
ffao |
C |
May 11, 2016, 6:26 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
108 |
9728000 |
|
2700 |
18600667 |
Whalanator |
C |
June 19, 2016, 3:11 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
140 |
1638400 |
|
2700 |
18575466 |
BSBandme |
C |
June 18, 2016, 9:10 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
140 |
9625600 |
|
2700 |
64333438 |
arthur.nascimento |
C |
Nov. 5, 2019, 8:29 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
140 |
10342400 |
|
2700 |
27354428 |
cry752264997 |
C |
May 26, 2017, 11:16 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
93 |
23244800 |
|
2700 |
65514285 |
mlby |
C |
Nov. 22, 2019, 6:04 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
93 |
124211200 |
|
2700 |
55107960 |
NotNight |
C |
June 5, 2019, 4:26 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
124 |
22425600 |
|
2700 |
52339740 |
NiroBC |
C |
April 5, 2019, 9:52 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
187 |
20480000 |
|
2700 |
27748675 |
AmberFrame |
C |
June 13, 2017, 4:38 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
187 |
35225600 |
|
2700 |
31145025 |
Amayoneko |
C |
Oct. 8, 2017, 1:12 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
202 |
2560000 |
|
2700 |
60326821 |
zsyzsy |
C |
Sept. 10, 2019, 2:21 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
218 |
70553600 |
|
2700 |
23786643 |
Hujiwara |
C |
Jan. 13, 2017, 2:27 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
233 |
12390400 |
|
2700 |
23914628 |
AomeII |
C |
Jan. 18, 2017, 5:13 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
234 |
16384000 |
|
2700 |
31145106 |
Amayoneko |
C |
Oct. 8, 2017, 1:17 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
280 |
7372800 |
|
2700 |
60195357 |
Lrztxdy |
C |
Sept. 7, 2019, 1:14 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
93 |
26112000 |
|
2700 |
60063869 |
vjudge2 |
C |
Sept. 5, 2019, 8:15 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
93 |
26112000 |
|
2700 |
60065053 |
vjudge1 |
C |
Sept. 5, 2019, 8:46 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
108 |
26112000 |
|
2700 |
65753263 |
hjk1030 |
C |
Nov. 26, 2019, 1:56 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
202 |
70144000 |
|
2700 |
57821012 |
Benq |
C |
July 26, 2019, 11:12 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
249 |
9011200 |
|
2700 |
60348206 |
iotang |
C |
Sept. 10, 2019, 1:20 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
264 |
94003200 |
|
2700 |
52341215 |
Fulisike |
C |
April 5, 2019, 10:37 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
280 |
37273600 |
|
2700 |
52074968 |
ujirani123 |
C |
March 31, 2019, 9:33 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
296 |
21401600 |
|
2700 |
60371527 |
iotang |
C |
Sept. 11, 2019, 2:28 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
311 |
94003200 |
|
2700 |
51591465 |
Shayan.P |
C |
March 20, 2019, 6:55 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
326 |
55398400 |
|
2700 |
19326879 |
hama-du |
C |
July 22, 2016, 3:10 p.m. |
OK |
Java 8 |
TESTS |
57 |
421 |
23244800 |
|
2700 |
17863337 |
uwi |
C |
May 11, 2016, 7:06 p.m. |
OK |
Java 8 |
TESTS |
57 |
499 |
37888000 |
|
2700 |
19057601 |
IgorKoval |
C |
July 12, 2016, 7:53 p.m. |
OK |
Java 8 |
TESTS |
57 |
530 |
21196800 |
|
2700 |
17929909 |
edorundo |
C |
May 16, 2016, 10:39 a.m. |
OK |
Java 8 |
TESTS |
57 |
1013 |
70348800 |
|
2700 |
17868277 |
Lewin |
C |
May 12, 2016, 2:27 a.m. |
OK |
Java 8 |
TESTS |
57 |
1231 |
83660800 |
|
2700 |
17868282 |
Lewin |
C |
May 12, 2016, 2:28 a.m. |
OK |
Java 8 |
TESTS |
57 |
1403 |
83660800 |
|
2700 |
17968959 |
ccdd4211 |
C |
May 17, 2016, 2:57 p.m. |
OK |
Java 8 |
TESTS |
57 |
1637 |
103321600 |
|
2700 |
18493522 |
TonySnark |
C |
June 15, 2016, 9:51 a.m. |
OK |
MS C++ |
TESTS |
57 |
280 |
39321600 |
|
2700 |
17916978 |
Ernest2002 |
C |
May 15, 2016, 8:28 a.m. |
OK |
MS C++ |
TESTS |
57 |
483 |
28774400 |
|
2700 |
22486654 |
AleksanderBalobanov |
C |
Nov. 25, 2016, 10:27 a.m. |
OK |
MS C++ |
TESTS |
57 |
686 |
62464000 |
|
2700 |
24090364 |
sdya |
C |
Jan. 24, 2017, 11:46 a.m. |
OK |
MS C++ |
TESTS |
57 |
920 |
43008000 |
|
2700 |
17865152 |
Taube |
C |
May 11, 2016, 7:52 p.m. |
OK |
MS C++ |
TESTS |
57 |
1170 |
51712000 |
|
2700 |
17865184 |
Taube |
C |
May 11, 2016, 7:54 p.m. |
OK |
MS C++ |
TESTS |
57 |
1216 |
51712000 |
|
2700 |
17866388 |
Milanin |
C |
May 11, 2016, 9:27 p.m. |
OK |
MS C++ |
TESTS |
57 |
1403 |
12492800 |
|
2700 |
17866448 |
Milanin |
C |
May 11, 2016, 9:33 p.m. |
OK |
MS C++ |
TESTS |
57 |
1466 |
12492800 |
|
2700 |
remove filters
Back to search problems