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"Josuke received a huge undirected weighted complete ^ dagger graph G as a gift from his grandfather. The graph contains 10^{18} vertices. The peculiarity of the gift is that the weight of the edge between the different vertices u and v is equal to gcd(u, v)^ ddagger . Josuke decided to experiment and make a new graph G' . To do this, he chooses two integers l <= r and deletes all vertices except such vertices v that l <= v <= r , and also deletes all the edges except between the remaining vertices. Now Josuke is wondering how many different weights are there in G' . Since their count turned out to be huge, he asks for your help. ^ dagger A complete graph is a simple undirected graph in which every pair of distinct vertices is adjacent. ^ ddagger gcd(x, y) denotes the greatest common divisor (GCD) of the numbers x and y . The first line contains one integer t ( 1 <= t <= 100 ) -- the number of test cases. The first line of each test case contains two numbers l , r ( 1 <= l <= r <= 10^{18} , l <= 10^9 ). For each test case print a single number -- the number of different weights among the remaining edges. The picture above shows that the graph has 2 different weights. In the fifth test case, there is only one vertex from which no edges originate, so the answer is 0 . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
190554166 |
rainboy |
E |
Jan. 25, 2023, 3:59 p.m. |
OK |
GNU C11 |
TESTS |
19 |
140 |
0 |
|
|
190558588 |
naf-fly |
E |
Jan. 25, 2023, 4:11 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
190548461 |
SkyClimber |
E |
Jan. 25, 2023, 3:45 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
1638400 |
|
|
190580001 |
samnever |
E |
Jan. 25, 2023, 6:20 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
7987200 |
|
|
190578893 |
samnever |
E |
Jan. 25, 2023, 6:11 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
7987200 |
|
|
190554189 |
Rainbow____ |
E |
Jan. 25, 2023, 3:59 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
61 |
0 |
|
|
190575678 |
sicupu |
E |
Jan. 25, 2023, 5:49 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
93 |
0 |
|
|
190593527 |
SergiiGolovko |
E |
Jan. 25, 2023, 8:59 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
108 |
0 |
|
|
190570995 |
DaiRuiChen007 |
E |
Jan. 25, 2023, 5:20 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
109 |
0 |
|
|
190555647 |
Asahi_Hjc |
E |
Jan. 25, 2023, 4:03 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
109 |
0 |
|
|
190613880 |
happycrazzy |
E |
Jan. 26, 2023, 5:26 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
109 |
0 |
|
|
190600469 |
mufti |
E |
Jan. 25, 2023, 11:57 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
0 |
0 |
|
|
190569339 |
thisthis |
E |
Jan. 25, 2023, 5:10 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
190569288 |
cpchenpi |
E |
Jan. 25, 2023, 5:10 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
190568979 |
thisthis |
E |
Jan. 25, 2023, 5:09 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
190562420 |
I_love_Anya_Gorodilova |
E |
Jan. 25, 2023, 4:23 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
190547412 |
yokozuna57 |
E |
Jan. 25, 2023, 3:43 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
190591027 |
go_emon |
E |
Jan. 25, 2023, 8:21 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
190558790 |
Jeuti |
E |
Jan. 25, 2023, 4:12 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
204800 |
|
|
190570064 |
Saiken |
E |
Jan. 25, 2023, 5:14 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
78 |
0 |
|
|
190570084 |
attempt0 |
E |
Jan. 25, 2023, 5:14 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
108 |
0 |
|
|
190578437 |
natsugiri |
E |
Jan. 25, 2023, 6:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
0 |
0 |
|
|
190559874 |
zjq123 |
E |
Jan. 25, 2023, 4:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
190600580 |
enslaved |
E |
Jan. 26, 2023, 12:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
190555995 |
Nyaan |
E |
Jan. 25, 2023, 4:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
62 |
0 |
|
|
190605851 |
Once_I_Liked_AGirl |
E |
Jan. 26, 2023, 2:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
124 |
0 |
|
|
190605032 |
Once_I_Liked_AGirl |
E |
Jan. 26, 2023, 2:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
124 |
0 |
|
|
190562035 |
GSYL |
E |
Jan. 25, 2023, 4:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
124 |
0 |
|
|
190550577 |
Joshc |
E |
Jan. 25, 2023, 3:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
140 |
0 |
|
|
190577472 |
Olerinskiy |
E |
Jan. 25, 2023, 6:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
140 |
0 |
|
|
190552622 |
heyujun |
E |
Jan. 25, 2023, 3:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
140 |
0 |
|
|
190585173 |
magnus.hegdahl |
E |
Jan. 25, 2023, 7:08 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
0 |
0 |
|
|
190579005 |
shakhnoov |
E |
Jan. 25, 2023, 6:12 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
0 |
0 |
|
|
190593948 |
MridulAhi |
E |
Jan. 25, 2023, 9:07 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
0 |
0 |
|
|
190606611 |
INF_512 |
E |
Jan. 26, 2023, 3:06 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
0 |
|
|
190601596 |
1RONMAN |
E |
Jan. 26, 2023, 12:40 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
0 |
|
|
190599105 |
zidder |
E |
Jan. 25, 2023, 11:11 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
0 |
|
|
190593273 |
triveni |
E |
Jan. 25, 2023, 8:55 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
0 |
|
|
190593312 |
DC17 |
E |
Jan. 25, 2023, 8:56 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
0 |
|
|
190614950 |
Kidding__Ma |
E |
Jan. 26, 2023, 5:42 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
0 |
|
|
190614416 |
Joler_ |
E |
Jan. 26, 2023, 5:34 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
0 |
|
|
190600038 |
dzhi |
E |
Jan. 25, 2023, 11:42 p.m. |
OK |
Java 11 |
TESTS |
19 |
202 |
0 |
|
|
190616050 |
Dinesh_Pandiyan |
E |
Jan. 26, 2023, 5:57 a.m. |
OK |
Java 11 |
TESTS |
19 |
405 |
0 |
|
|
190572126 |
merlin_ |
E |
Jan. 25, 2023, 5:27 p.m. |
OK |
Java 11 |
TESTS |
19 |
405 |
0 |
|
|
190558801 |
profchi |
E |
Jan. 25, 2023, 4:12 p.m. |
OK |
Java 11 |
TESTS |
19 |
748 |
0 |
|
|
190575665 |
Dukkha |
E |
Jan. 25, 2023, 5:49 p.m. |
OK |
Java 17 |
TESTS |
19 |
280 |
819200 |
|
|
190603110 |
IanISam |
E |
Jan. 26, 2023, 1:33 a.m. |
OK |
Java 8 |
TESTS |
19 |
872 |
0 |
|
|
190582990 |
codicon |
E |
Jan. 25, 2023, 6:46 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
1777 |
3788800 |
|
|
190611770 |
hkwu6013 |
E |
Jan. 26, 2023, 4:51 a.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
140 |
2560000 |
|
|
190608006 |
mkawa2 |
E |
Jan. 26, 2023, 3:40 a.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
265 |
2457600 |
|
|
190562397 |
ris04hit |
E |
Jan. 25, 2023, 4:23 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
265 |
2764800 |
|
|
190607183 |
xxh1999 |
E |
Jan. 26, 2023, 3:20 a.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
358 |
3686400 |
|
|
190583052 |
codicon |
E |
Jan. 25, 2023, 6:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
358 |
3686400 |
|
|
190606716 |
Little_Sheep_Yawn |
E |
Jan. 26, 2023, 3:08 a.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
373 |
11673600 |
|
|
190562556 |
googlweknoall |
E |
Jan. 25, 2023, 4:23 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
374 |
3379200 |
|
|
190558923 |
huangxw |
E |
Jan. 25, 2023, 4:12 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
374 |
3686400 |
|
|
190602134 |
liut |
E |
Jan. 26, 2023, 12:58 a.m. |
OK |
Rust 2021 |
TESTS |
19 |
124 |
0 |
|
|
190602087 |
liut |
E |
Jan. 26, 2023, 12:57 a.m. |
OK |
Rust 2021 |
TESTS |
19 |
764 |
0 |
|
|
190602097 |
liut |
E |
Jan. 26, 2023, 12:57 a.m. |
OK |
Rust 2021 |
TESTS |
19 |
795 |
0 |
|
|
remove filters
Back to search problems