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
Arkadiy has lots square photos with size a × a . He wants to put some of them on a rectangular wall with size h × w . The photos which Arkadiy will put on the wall must form a rectangular grid and the distances between neighboring vertically and horizontally photos and also the distances between outside rows and columns of photos to the nearest bound of the wall must be equal to x , where x is some non-negative real number. Look on the picture below for better understanding of the statement. Arkadiy haven't chosen yet how many photos he would put on the wall, however, he want to put at least one photo. Your task is to determine the minimum value of x which can be obtained after putting photos, or report that there is no way to put positive number of photos and satisfy all the constraints. Suppose that Arkadiy has enough photos to make any valid arrangement according to the constraints. Note that Arkadiy wants to put at least one photo on the wall. The photos should not overlap, should completely lie inside the wall bounds and should have sides parallel to the wall sides. The first line contains three integers a , h and w ( 1 ≤ a , h , w ≤ 10 9 ) — the size of photos and the height and the width of the wall. Print one non-negative real number — the minimum value of x which can be obtained after putting the photos on the wall. The absolute or the relative error of the answer must not exceed 10 - 6 . Print -1 if there is no way to put positive number of photos and satisfy the constraints. In the first example Arkadiy can put 7 rows of photos with 5 photos in each row, so the minimum value of x equals to 0.5 . In the second example Arkadiy can put only 1 photo which will take the whole wall, so the minimum value of x equals to 0 . In the third example there is no way to put positive number of photos and satisfy the constraints described in the statement, so the answer is -1 . |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
26233775 |
_ShadowSong |
G |
April 9, 2017, 9:29 a.m. |
OK |
D |
TESTS |
55 |
15 |
2969600 |
|
2900 |
|
26354352 |
krijgertje |
G |
April 14, 2017, 10:43 a.m. |
OK |
GNU C |
TESTS |
55 |
15 |
1945600 |
|
2900 |
|
27479275 |
jyt1999 |
G |
June 1, 2017, 7:02 a.m. |
OK |
GNU C++ |
TESTS |
55 |
15 |
0 |
|
2900 |
|
27181995 |
MasterJH5574 |
G |
May 17, 2017, 2:42 p.m. |
OK |
GNU C++ |
TESTS |
55 |
15 |
0 |
|
2900 |
|
26816003 |
MemS |
G |
May 3, 2017, 9:24 a.m. |
OK |
GNU C++ |
TESTS |
55 |
15 |
2048000 |
|
2900 |
|
33997092 |
Lazyman |
G |
Jan. 8, 2018, 4:57 a.m. |
OK |
GNU C++11 |
TESTS |
55 |
15 |
2048000 |
|
2900 |
|
26207748 |
Toxel |
G |
April 8, 2017, 4:30 a.m. |
OK |
GNU C++11 |
TESTS |
55 |
15 |
2048000 |
|
2900 |
|
26172017 |
J.T.J.L. |
G |
April 6, 2017, 2:02 p.m. |
OK |
GNU C++11 |
TESTS |
55 |
15 |
2048000 |
|
2900 |
|
26802469 |
XLightGod |
G |
May 2, 2017, 12:47 p.m. |
OK |
GNU C++11 |
TESTS |
55 |
15 |
2150400 |
|
2900 |
|
64122199 |
zs__std |
G |
Nov. 3, 2019, 2:13 a.m. |
OK |
GNU C++11 |
TESTS |
55 |
31 |
0 |
|
2900 |
|
59970371 |
luogu_bot4 |
G |
Sept. 4, 2019, 12:26 a.m. |
OK |
GNU C++11 |
TESTS |
55 |
31 |
0 |
|
2900 |
|
57631210 |
EmptySoulist |
G |
July 24, 2019, 8:48 a.m. |
OK |
GNU C++11 |
TESTS |
55 |
31 |
0 |
|
2900 |
|
57631191 |
Taday |
G |
July 24, 2019, 8:48 a.m. |
OK |
GNU C++11 |
TESTS |
55 |
31 |
0 |
|
2900 |
|
57580859 |
cleaner_CZ |
G |
July 23, 2019, 8:49 a.m. |
OK |
GNU C++11 |
TESTS |
55 |
31 |
0 |
|
2900 |
|
57580766 |
luogu_bot4 |
G |
July 23, 2019, 8:47 a.m. |
OK |
GNU C++11 |
TESTS |
55 |
31 |
0 |
|
2900 |
|
35955345 |
MegaOwIer |
G |
March 5, 2018, 3:33 a.m. |
OK |
GNU C++14 |
TESTS |
55 |
15 |
1945600 |
|
2900 |
|
26680397 |
libra9z |
G |
April 26, 2017, 11:27 a.m. |
OK |
GNU C++14 |
TESTS |
55 |
15 |
1945600 |
|
2900 |
|
26317337 |
unused |
G |
April 12, 2017, 12:42 p.m. |
OK |
GNU C++14 |
TESTS |
55 |
15 |
1945600 |
|
2900 |
|
26185257 |
Lobanov_VAVKO |
G |
April 7, 2017, 6:34 a.m. |
OK |
GNU C++14 |
TESTS |
55 |
15 |
1945600 |
|
2900 |
|
26182063 |
jasonvictoryan |
G |
April 7, 2017, 1:01 a.m. |
OK |
GNU C++14 |
TESTS |
55 |
15 |
1945600 |
|
2900 |
|
26257305 |
CodingKnight |
G |
April 10, 2017, 3:55 p.m. |
OK |
GNU C++14 |
TESTS |
55 |
30 |
1945600 |
|
2900 |
|
40528567 |
Vatinkriv |
G |
July 19, 2018, 12:35 a.m. |
OK |
GNU C++14 |
TESTS |
55 |
31 |
0 |
|
2900 |
|
30631021 |
Iskalibur |
G |
Sept. 23, 2017, 5:45 a.m. |
OK |
GNU C++14 |
TESTS |
55 |
624 |
0 |
|
2900 |
|
69842890 |
CodingKnight |
G |
Jan. 30, 2020, 1:37 p.m. |
OK |
GNU C++17 |
TESTS |
55 |
31 |
0 |
|
2900 |
|
69841788 |
CodingKnight |
G |
Jan. 30, 2020, 1:21 p.m. |
OK |
GNU C++17 |
TESTS |
55 |
31 |
0 |
|
2900 |
|
26345731 |
6eJIa9IzZzTeHb |
G |
April 13, 2017, 6:37 p.m. |
OK |
Java 8 |
TESTS |
55 |
140 |
20992000 |
|
2900 |
|
26571180 |
sundown |
G |
April 22, 2017, 12:34 a.m. |
OK |
MS C# |
TESTS |
55 |
62 |
9420800 |
|
2900 |
|
28370208 |
ze177482 |
G |
July 8, 2017, 1:29 p.m. |
OK |
MS C++ |
TESTS |
55 |
15 |
2048000 |
|
2900 |
|
40982858 |
ReaLNero1 |
G |
July 30, 2018, 6:36 p.m. |
OK |
Perl |
TESTS |
55 |
46 |
0 |
|
2900 |
|
34605018 |
2005_shakula |
G |
Jan. 27, 2018, 12:17 p.m. |
OK |
Python 3 |
TESTS |
55 |
62 |
5632000 |
|
2900 |
|
44402577 |
vjudge3 |
G |
Oct. 16, 2018, 1:31 p.m. |
OK |
Python 3 |
TESTS |
55 |
109 |
0 |
|
2900 |
|
44403323 |
luogu_bot5 |
G |
Oct. 16, 2018, 1:50 p.m. |
OK |
Python 3 |
TESTS |
55 |
124 |
0 |
|
2900 |
|
43575617 |
vjudge3 |
G |
Sept. 29, 2018, 2:46 p.m. |
OK |
Python 3 |
TESTS |
55 |
124 |
102400 |
|
2900 |
|
43575469 |
vjudge1 |
G |
Sept. 29, 2018, 2:41 p.m. |
OK |
Python 3 |
TESTS |
55 |
124 |
102400 |
|
2900 |
remove filters
Back to search problems