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"Mircea has n pictures. The i -th picture is a square with a side length of s_i centimeters. He mounted each picture on a square piece of cardboard so that each picture has a border of w centimeters of cardboard on all sides. In total, he used c square centimeters of cardboard. Given the picture sizes and the value c , can you find the value of w ? Please note that the piece of cardboard goes behind each picture, not just the border. The first line contains a single integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The first line of each test case contains two positive integers n ( 1 <= q n <= q 2 cdot 10^5 ) and c ( 1 <= q c <= q 10^{18} ) -- the number of paintings, and the amount of used square centimeters of cardboard. The second line of each test case contains n space-separated integers s_i ( 1 <= q s_i <= q 10^4 ) -- the sizes of the paintings. The sum of n over all test cases doesn't exceed 2 cdot 10^5 . Additional constraint on the input: Such an integer w exists for each test case. Please note, that some of the input for some test cases won't fit into 32-bit integer type, so you should use at least 64-bit integer type in your programming language (like long long for C++). For each test case, output a single integer -- the value of w ( w geq 1 ) which was used to use exactly c squared centimeters of cardboard. The first test case is explained in the statement. For the second test case, the chosen w was 2 , thus the only cardboard covers an area of c = (2 cdot 2 + 6)^2 = 10^2 = 100 squared centimeters. For the third test case, the chosen w was 4 , which obtains the covered area c = (2 cdot 4 + 2)^2 x 5 = 10^2 x 5 = 100 x 5 = 500 squared centimeters. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
215093961 |
NenadDapic |
E |
July 22, 2023, 7:20 p.m. |
OK |
FPC |
TESTS |
14 |
62 |
819200 |
|
|
215093577 |
NenadDapic |
E |
July 22, 2023, 7:16 p.m. |
OK |
FPC |
TESTS |
14 |
62 |
1638400 |
|
|
215130246 |
ngoduc |
E |
July 23, 2023, 6 a.m. |
OK |
GNU C11 |
TESTS |
14 |
61 |
1638400 |
|
|
215018406 |
swapash |
E |
July 22, 2023, 8:44 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
0 |
|
|
215121029 |
Hager_Ashraf428 |
E |
July 23, 2023, 3:29 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
0 |
|
|
215113089 |
alaylm |
E |
July 23, 2023, 1:05 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
0 |
|
|
215070911 |
Adham_Ali |
E |
July 22, 2023, 4:09 p.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
0 |
|
|
215062968 |
patilsumitpravinkumar |
E |
July 22, 2023, 3:17 p.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
819200 |
|
|
215022188 |
W.L.BUG |
E |
July 22, 2023, 9:14 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
819200 |
|
|
215021923 |
W.L.BUG |
E |
July 22, 2023, 9:12 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
819200 |
|
|
215020293 |
W.L.BUG |
E |
July 22, 2023, 8:59 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
819200 |
|
|
215120573 |
_fengxiaoyi |
E |
July 23, 2023, 3:22 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
819200 |
|
|
215063228 |
coder_pulkit_s |
E |
July 22, 2023, 3:18 p.m. |
OK |
GNU C++14 |
TESTS |
14 |
46 |
1638400 |
|
|
215120019 |
_LONE__WOLF_ |
E |
July 23, 2023, 3:13 a.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215106744 |
omarbahgat |
E |
July 22, 2023, 10:22 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215096046 |
Samar.Mahmoud |
E |
July 22, 2023, 7:43 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215089995 |
amromeshref |
E |
July 22, 2023, 6:38 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215079656 |
_sandbox |
E |
July 22, 2023, 5:11 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215078796 |
Legioncy |
E |
July 22, 2023, 5:04 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215127257 |
Anubhav0302 |
E |
July 23, 2023, 5:22 a.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215058537 |
RNS_JK |
E |
July 22, 2023, 2:48 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215057747 |
Jaivik_kalathiya |
E |
July 22, 2023, 2:42 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215064454 |
Rishikesh_Reddy_ |
E |
July 22, 2023, 3:27 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
46 |
0 |
|
|
215076863 |
chotaneem |
E |
July 22, 2023, 4:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
0 |
|
|
215057185 |
EnEm |
E |
July 22, 2023, 2:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
0 |
|
|
215090566 |
ilgiz228 |
E |
July 22, 2023, 6:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
0 |
|
|
215018253 |
nytc |
E |
July 22, 2023, 8:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
819200 |
|
|
215102203 |
salo7aa |
E |
July 22, 2023, 9:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
1638400 |
|
|
215116911 |
OTTFF |
E |
July 23, 2023, 2:18 a.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
1638400 |
|
|
215109355 |
Babbi |
E |
July 22, 2023, 11:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
1638400 |
|
|
215095146 |
NadaMansour20 |
E |
July 22, 2023, 7:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
1638400 |
|
|
215087836 |
Vax |
E |
July 22, 2023, 6:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
1638400 |
|
|
215084936 |
Leoknowstheway |
E |
July 22, 2023, 5:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
31 |
1638400 |
|
|
215072951 |
ZeinSH |
E |
July 22, 2023, 4:23 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
215071638 |
amitskingh |
E |
July 22, 2023, 4:14 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
30 |
0 |
|
|
215065783 |
darkl0rd |
E |
July 22, 2023, 3:36 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
30 |
0 |
|
|
215058564 |
Savva228 |
E |
July 22, 2023, 2:48 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
30 |
0 |
|
|
215067394 |
ozz.life |
E |
July 22, 2023, 3:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
30 |
0 |
|
|
215058163 |
danhvinhlee |
E |
July 22, 2023, 2:45 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
30 |
1638400 |
|
|
215123728 |
Fighter-Man |
E |
July 23, 2023, 4:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
31 |
0 |
|
|
215119455 |
NooB_WitH_A_SmalL_BraiN |
E |
July 23, 2023, 3:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
31 |
0 |
|
|
215119443 |
SecreTZonE |
E |
July 23, 2023, 3:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
31 |
0 |
|
|
215118995 |
honeynut |
E |
July 23, 2023, 2:56 a.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
31 |
0 |
|
|
215090421 |
Hsharma |
E |
July 22, 2023, 6:42 p.m. |
OK |
Java 11 |
TESTS |
14 |
218 |
0 |
|
|
215024985 |
ananya_s_s |
E |
July 22, 2023, 9:35 a.m. |
OK |
Java 11 |
TESTS |
14 |
249 |
0 |
|
|
215050212 |
ananya_s_s |
E |
July 22, 2023, 1:46 p.m. |
OK |
Java 11 |
TESTS |
14 |
249 |
0 |
|
|
215072510 |
sambhav19329 |
E |
July 22, 2023, 4:20 p.m. |
OK |
Java 11 |
TESTS |
14 |
390 |
0 |
|
|
215086590 |
SmartCode |
E |
July 22, 2023, 6:08 p.m. |
OK |
Java 11 |
TESTS |
14 |
451 |
0 |
|
|
215064477 |
Vrutik_2809 |
E |
July 22, 2023, 3:27 p.m. |
OK |
Java 17 |
TESTS |
14 |
186 |
409600 |
|
|
215071081 |
coder0687 |
E |
July 22, 2023, 4:10 p.m. |
OK |
Java 17 |
TESTS |
14 |
186 |
614400 |
|
|
215052187 |
try1111111 |
E |
July 22, 2023, 2:01 p.m. |
OK |
Java 17 |
TESTS |
14 |
187 |
204800 |
|
|
215073970 |
sumit2018das2004 |
E |
July 22, 2023, 4:30 p.m. |
OK |
Java 17 |
TESTS |
14 |
217 |
409600 |
|
|
215016849 |
rated21 |
E |
July 22, 2023, 8:32 a.m. |
OK |
Java 17 |
TESTS |
14 |
218 |
614400 |
|
|
215014340 |
iamdimonis |
E |
July 22, 2023, 8:12 a.m. |
OK |
Java 17 |
TESTS |
14 |
233 |
0 |
|
|
215013871 |
Just4Fun_ |
E |
July 22, 2023, 8:09 a.m. |
OK |
Java 17 |
TESTS |
14 |
233 |
0 |
|
|
215076600 |
Black-Heart |
E |
July 22, 2023, 4:47 p.m. |
OK |
Java 17 |
TESTS |
14 |
234 |
15872000 |
|
|
215120270 |
mangos194 |
E |
July 23, 2023, 3:17 a.m. |
OK |
Java 17 |
TESTS |
14 |
248 |
204800 |
|
|
215065338 |
ADust |
E |
July 22, 2023, 3:33 p.m. |
OK |
Java 17 |
TESTS |
14 |
249 |
307200 |
|
|
215015193 |
292_KJ |
E |
July 22, 2023, 8:19 a.m. |
OK |
Java 8 |
TESTS |
14 |
124 |
0 |
|
|
215087640 |
raj_shahh |
E |
July 22, 2023, 6:17 p.m. |
OK |
Java 8 |
TESTS |
14 |
124 |
1843200 |
|
|
215048472 |
ahmedhosny2002 |
E |
July 22, 2023, 1:34 p.m. |
OK |
Java 8 |
TESTS |
14 |
140 |
0 |
|
|
215084884 |
Harshit_3905 |
E |
July 22, 2023, 5:54 p.m. |
OK |
Java 8 |
TESTS |
14 |
155 |
2150400 |
|
|
215016599 |
sumitsk007 |
E |
July 22, 2023, 8:30 a.m. |
OK |
Java 8 |
TESTS |
14 |
155 |
13824000 |
|
|
215013093 |
American_Eagle |
E |
July 22, 2023, 8:05 a.m. |
OK |
Java 8 |
TESTS |
14 |
171 |
2867200 |
|
|
215048948 |
r.c |
E |
July 22, 2023, 1:37 p.m. |
OK |
Java 8 |
TESTS |
14 |
326 |
0 |
|
|
215129849 |
amit_roy |
E |
July 23, 2023, 5:56 a.m. |
OK |
Java 8 |
TESTS |
14 |
342 |
0 |
|
|
215129219 |
amit_roy |
E |
July 23, 2023, 5:49 a.m. |
OK |
Java 8 |
TESTS |
14 |
342 |
0 |
|
|
215055784 |
gelbelachente |
E |
July 22, 2023, 2:27 p.m. |
OK |
Kotlin 1.7 |
TESTS |
14 |
1357 |
190771200 |
|
|
215125573 |
MengXn |
E |
July 23, 2023, 4:54 a.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
124 |
819200 |
|
|
215107349 |
TawfekHesham |
E |
July 22, 2023, 10:37 p.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
140 |
5017600 |
|
|
215108628 |
Abdullah_Mahmoud |
E |
July 22, 2023, 11:09 p.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
155 |
2252800 |
|
|
215059361 |
Zeyad.AnkhAmon99 |
E |
July 22, 2023, 2:54 p.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
156 |
819200 |
|
|
215015858 |
kjasn |
E |
July 22, 2023, 8:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
156 |
1638400 |
|
|
215114148 |
lirejie |
E |
July 23, 2023, 1:26 a.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
156 |
3993600 |
|
|
215016800 |
hehe_vro |
E |
July 22, 2023, 8:32 a.m. |
OK |
PyPy 3 |
TESTS |
14 |
202 |
16998400 |
|
|
215062537 |
Dmitry07 |
E |
July 22, 2023, 3:14 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
233 |
15872000 |
|
|
215016940 |
PoDuReMaN |
E |
July 22, 2023, 8:33 a.m. |
OK |
PyPy 3 |
TESTS |
14 |
249 |
15564800 |
|
|
215073319 |
linhhlp |
E |
July 22, 2023, 4:26 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
249 |
18739200 |
|
|
215048375 |
keguaiguai |
E |
July 22, 2023, 1:34 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
265 |
15564800 |
|
|
215082499 |
ashucoder |
E |
July 22, 2023, 5:35 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
280 |
15052800 |
|
|
215028494 |
Manav021 |
E |
July 22, 2023, 10:11 a.m. |
OK |
PyPy 3 |
TESTS |
14 |
280 |
15360000 |
|
|
215026128 |
lol_py |
E |
July 22, 2023, 9:46 a.m. |
OK |
PyPy 3 |
TESTS |
14 |
280 |
15564800 |
|
|
215104662 |
abhay_codes |
E |
July 22, 2023, 9:43 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
514 |
15360000 |
|
|
215051456 |
_0Istahak |
E |
July 22, 2023, 1:55 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
545 |
15872000 |
|
|
215118065 |
Habibi-is-practicing |
E |
July 23, 2023, 2:39 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
93 |
21606400 |
|
|
215073256 |
smilence |
E |
July 22, 2023, 4:25 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
108 |
17408000 |
|
|
215096838 |
Sacheth_Koushik |
E |
July 22, 2023, 7:53 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
108 |
21811200 |
|
|
215118905 |
Habibi-is-practicing |
E |
July 23, 2023, 2:54 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
109 |
20684800 |
|
|
215071287 |
Alpha_Goo |
E |
July 22, 2023, 4:12 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
109 |
22118400 |
|
|
215061296 |
eternal_happiness |
E |
July 22, 2023, 3:06 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
124 |
18944000 |
|
|
215060318 |
Varad |
E |
July 22, 2023, 2:59 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
124 |
20377600 |
|
|
215119760 |
jamerrq |
E |
July 23, 2023, 3:09 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
124 |
22118400 |
|
|
215079677 |
Osplei |
E |
July 22, 2023, 5:12 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
155 |
16793600 |
|
|
215020174 |
AbdoRBK |
E |
July 22, 2023, 8:58 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
155 |
16896000 |
|
|
215072174 |
Mohamed_712 |
E |
July 22, 2023, 4:18 p.m. |
OK |
Python 3 |
TESTS |
14 |
109 |
27852800 |
|
|
215024481 |
Gary_ganymede |
E |
July 22, 2023, 9:31 a.m. |
OK |
Python 3 |
TESTS |
14 |
124 |
26419200 |
|
|
215086872 |
dyanggg |
E |
July 22, 2023, 6:11 p.m. |
OK |
Python 3 |
TESTS |
14 |
124 |
27238400 |
|
|
215121384 |
smooth_hunter |
E |
July 23, 2023, 3:36 a.m. |
OK |
Python 3 |
TESTS |
14 |
124 |
27852800 |
|
|
215075575 |
Kushhhhh |
E |
July 22, 2023, 4:41 p.m. |
OK |
Python 3 |
TESTS |
14 |
124 |
27852800 |
|
|
215068769 |
jalapathisharathchandra |
E |
July 22, 2023, 3:56 p.m. |
OK |
Python 3 |
TESTS |
14 |
124 |
27852800 |
|
|
215062925 |
EotUL8d7 |
E |
July 22, 2023, 3:16 p.m. |
OK |
Python 3 |
TESTS |
14 |
124 |
27852800 |
|
|
215033756 |
KAMITO |
E |
July 22, 2023, 11:09 a.m. |
OK |
Python 3 |
TESTS |
14 |
124 |
27852800 |
|
|
215024868 |
RewNa |
E |
July 22, 2023, 9:34 a.m. |
OK |
Python 3 |
TESTS |
14 |
124 |
27852800 |
|
|
215107667 |
im.priyansh |
E |
July 22, 2023, 10:46 p.m. |
OK |
Python 3 |
TESTS |
14 |
139 |
20787200 |
|
|
215056092 |
0x81 |
E |
July 22, 2023, 2:30 p.m. |
OK |
Ruby 3 |
TESTS |
14 |
1279 |
19763200 |
|
|
215093808 |
paleApricot |
E |
July 22, 2023, 7:18 p.m. |
OK |
Rust 2021 |
TESTS |
14 |
15 |
5939200 |
|
|
215072733 |
ilyshana |
E |
July 22, 2023, 4:22 p.m. |
OK |
Rust 2021 |
TESTS |
14 |
15 |
6348800 |
|
|
215061912 |
aldric_li |
E |
July 22, 2023, 3:10 p.m. |
OK |
Rust 2021 |
TESTS |
14 |
31 |
6246400 |
|
|
215111588 |
lucbarn |
E |
July 23, 2023, 12:26 a.m. |
OK |
Rust 2021 |
TESTS |
14 |
31 |
6348800 |
|
|
215098985 |
TimaFrolov |
E |
July 22, 2023, 8:20 p.m. |
OK |
Rust 2021 |
TESTS |
14 |
31 |
6348800 |
|
|
215093168 |
paleApricot |
E |
July 22, 2023, 7:12 p.m. |
OK |
Rust 2021 |
TESTS |
14 |
31 |
9113600 |
|
|
215094480 |
paleApricot |
E |
July 22, 2023, 7:25 p.m. |
OK |
Rust 2021 |
TESTS |
14 |
46 |
14745600 |
|
|
215021687 |
ayhon |
E |
July 22, 2023, 9:10 a.m. |
OK |
Rust 2021 |
TESTS |
14 |
46 |
14745600 |
|
|
215021868 |
ayhon |
E |
July 22, 2023, 9:11 a.m. |
OK |
Rust 2021 |
TESTS |
14 |
46 |
16384000 |
|
|
remove filters
Back to search problems