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'Ran Yakumo is a cute girl who loves creating cute Maths problems. Let f(x) be the minimal square number strictly greater than x , and g(x) be the maximal square number less than or equal to x . For example, f(1)=f(2)=g(4)=g(8)=4 . A positive integer x is cute if x-g(x)<f(x)-x . For example, 1,5,11 are cute integers, while 3,8,15 are not. Ran gives you an array a of length n . She wants you to find the smallest non-negative integer k such that a_i + k is a cute number for any element of a . The first line contains one integer n ( 1 <= q n <= q 10^6 ) -- the length of a . The second line contains n intergers a_1,a_2, ldots,a_n ( 1 <= q a_1 <= q a_2 <= q ldots <= q a_n <= q 2 cdot 10^6 ) -- the array a . Print a single interger k -- the answer. Test case 1: 3 is not cute integer, so k ne 0 . 2,4,9,11 are cute integers, so k=1 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
159415723 |
Gassa |
D |
June 3, 2022, 5:18 p.m. |
OK |
D |
TESTS |
56 |
468 |
37888000 |
|
|
159429217 |
Gassa |
D |
June 3, 2022, 7:43 p.m. |
OK |
D |
TESTS |
58 |
498 |
48640000 |
|
|
159415528 |
Gassa |
D |
June 3, 2022, 5:17 p.m. |
OK |
D |
TESTS |
56 |
577 |
37888000 |
|
|
remove filters
Back to search problems