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 a positive integer n. Let's build a graph on vertices 1, xe2 x80 x892, xe2 x80 x89..., xe2 x80 x89n in such a way that there is an edge between vertices u and v if and only if . Let d(u, xe2 x80 x89v) be the shortest distance between u and v, or 0 if there is no path between them. Compute the sum of values d(u, xe2 x80 x89v) over all 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89u xe2 x80 x89< xe2 x80 x89v xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n. The gcd (greatest common divisor) of two positive integers is the maximum positive integer that divides both of the integers. Single integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89107). Print the sum of d(u, xe2 x80 x89v) over all 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89u xe2 x80 x89< xe2 x80 x89v xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n. All shortest paths in the first example: There are no paths between other pairs of vertices. The total distance is 2 xe2 x80 x89+ xe2 x80 x891 xe2 x80 x89+ xe2 x80 x891 xe2 x80 x89+ xe2 x80 x892 xe2 x80 x89+ xe2 x80 x891 xe2 x80 x89+ xe2 x80 x891 xe2 x80 x89= xe2 x80 x898. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
36251366 |
beginend |
F |
March 13, 2018, 2 p.m. |
OK |
GNU C++ |
TESTS |
33 |
186 |
172441600 |
|
2600 |
34062000 |
Evino |
F |
Jan. 10, 2018, 4:56 a.m. |
OK |
GNU C++ |
TESTS |
33 |
217 |
202240000 |
|
2600 |
39024642 |
huangyuanlang |
F |
June 7, 2018, 2:40 p.m. |
OK |
GNU C++ |
TESTS |
33 |
234 |
200192000 |
|
2600 |
34067854 |
ONION_CYC |
F |
Jan. 10, 2018, 11:42 a.m. |
OK |
GNU C++ |
TESTS |
33 |
249 |
242380800 |
|
2600 |
34067816 |
ONION_CYC |
F |
Jan. 10, 2018, 11:40 a.m. |
OK |
GNU C++ |
TESTS |
33 |
264 |
242380800 |
|
2600 |
35593972 |
Scut82 |
F |
Feb. 23, 2018, 10:42 a.m. |
OK |
GNU C++ |
TESTS |
33 |
280 |
166400000 |
|
2600 |
32184334 |
1234567891 |
F |
Nov. 10, 2017, 2:17 a.m. |
OK |
GNU C++ |
TESTS |
33 |
280 |
200396800 |
|
2600 |
40106546 |
luogu_bot3 |
F |
July 9, 2018, 8:52 a.m. |
OK |
GNU C++ |
TESTS |
33 |
296 |
208691200 |
|
2600 |
31884006 |
Worldwide_D |
F |
Oct. 30, 2017, 7:44 a.m. |
OK |
GNU C++ |
TESTS |
33 |
311 |
250265600 |
|
2600 |
35593747 |
Scut82 |
F |
Feb. 23, 2018, 10:31 a.m. |
OK |
GNU C++ |
TESTS |
33 |
312 |
162406400 |
|
2600 |
40979521 |
ReaLNero1 |
F |
July 30, 2018, 5:07 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
124 |
170393600 |
|
2600 |
33857523 |
jslijin |
F |
Jan. 2, 2018, 4:01 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
139 |
106291200 |
|
2600 |
56057181 |
time_interspace |
F |
June 26, 2019, 1:28 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
155 |
94208000 |
|
2600 |
52061682 |
vjudge2 |
F |
March 31, 2019, 1:49 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
155 |
200396800 |
|
2600 |
56747504 |
luogu_bot3 |
F |
July 9, 2019, 10:28 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
187 |
132812800 |
|
2600 |
56747470 |
xcxxcx |
F |
July 9, 2019, 10:27 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
187 |
132812800 |
|
2600 |
57618485 |
Nihilism |
F |
July 24, 2019, 3:03 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
187 |
160358400 |
|
2600 |
56252214 |
luhong |
F |
June 29, 2019, 4:11 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
202 |
170496000 |
|
2600 |
56250081 |
si_nian |
F |
June 29, 2019, 2:15 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
202 |
200396800 |
|
2600 |
56742854 |
kone2017 |
F |
July 9, 2019, 8:26 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
202 |
240435200 |
|
2600 |
31441579 |
NiroBC |
F |
Oct. 17, 2017, 7:18 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
217 |
162201600 |
|
2600 |
35788917 |
wfj_2048 |
F |
Feb. 28, 2018, 3:05 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
217 |
202342400 |
|
2600 |
34108771 |
Marco_L_T |
F |
Jan. 12, 2018, 2:45 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
249 |
216371200 |
|
2600 |
33698417 |
CQzhangyu |
F |
Dec. 28, 2017, 12:51 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
280 |
210329600 |
|
2600 |
31467037 |
I_Love_Umirzhanova_Amina |
F |
Oct. 18, 2017, 2:52 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
295 |
202342400 |
|
2600 |
31375805 |
Kerim.K |
F |
Oct. 15, 2017, 7:04 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
296 |
168550400 |
|
2600 |
34108842 |
Marco_L_T |
F |
Jan. 12, 2018, 2:48 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
296 |
216268800 |
|
2600 |
57617543 |
vjudge5 |
F |
July 24, 2019, 2:29 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
311 |
240435200 |
|
2600 |
34607751 |
lbn187 |
F |
Jan. 27, 2018, 1:58 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
312 |
235724800 |
|
2600 |
33372382 |
AprilGrimoire |
F |
Dec. 18, 2017, 8:21 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
421 |
202342400 |
|
2600 |
61099419 |
vjudge1 |
F |
Sept. 23, 2019, 5:51 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
234 |
200396800 |
|
2600 |
61347591 |
vjudge5 |
F |
Sept. 27, 2019, 6:05 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
249 |
240435200 |
|
2600 |
61099444 |
vjudge2 |
F |
Sept. 23, 2019, 5:52 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
280 |
200396800 |
|
2600 |
57618158 |
Duanyll |
F |
July 24, 2019, 2:50 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
280 |
330649600 |
|
2600 |
57618230 |
vjudge1 |
F |
July 24, 2019, 2:53 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
327 |
330649600 |
|
2600 |
57615607 |
chengyufeng |
F |
July 24, 2019, 1:19 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
327 |
330649600 |
|
2600 |
65469077 |
A_Fan_of_the_AK_King--lk |
F |
Nov. 21, 2019, 7:35 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
452 |
208384000 |
|
2600 |
48861682 |
Medeowex |
F |
Jan. 23, 2019, 11:08 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
514 |
90419200 |
|
2600 |
60443772 |
SGHD |
F |
Sept. 12, 2019, 1:26 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
654 |
120217600 |
|
2600 |
67854037 |
brandonzhang |
F |
Dec. 29, 2019, 5:11 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
920 |
246784000 |
|
2600 |
remove filters
Back to search problems