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'This problem is a complicated version of D1, but it has significant differences, so read the whole statement. Polycarp has an array of n ( n is even) integers a_1, a_2, ... , a_n . Polycarp conceived of a positive integer k . After that, Polycarp began performing the following operations on the array: take an index i ( 1 <= i <= n ) and reduce the number a_i by k . After Polycarp performed some (possibly zero) number of such operations, it turned out that at least half of the numbers in the array became the same. Find the maximum k at which such a situation is possible, or print -1 if such a number can be arbitrarily large. The first line contains one integer t ( 1 <= t <= 10 ) -- the number of test cases. Then t test cases follow. Each test case consists of two lines. The first line contains an even integer n ( 4 <= n <= 40 ) ( n is even). The second line contains n integers a_1, a_2, ... a_n ( -10^6 <= a_i <= 10^6 ). It is guaranteed that the sum of all n specified in the given test cases does not exceed 100 . For each test case output on a separate line an integer k ( k ge 1 ) -- the maximum possible number that Polycarp used in operations on the array, or -1 , if such a number can be arbitrarily large. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
131931734 |
ruban |
D2 |
Oct. 14, 2021, 11:57 a.m. |
OK |
Delphi |
TESTS |
59 |
109 |
226099200 |
|
|
131955446 |
kidw0124 |
D2 |
Oct. 14, 2021, 3:39 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
0 |
|
|
131949000 |
Ulzl00 |
D2 |
Oct. 14, 2021, 2:29 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
102400 |
|
|
131922022 |
yash_4 |
D2 |
Oct. 14, 2021, 10:27 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
102400 |
|
|
131949549 |
jty233 |
D2 |
Oct. 14, 2021, 2:35 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
204800 |
|
|
131944767 |
Mercuryyy |
D2 |
Oct. 14, 2021, 1:51 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
204800 |
|
|
131944667 |
Mercuryyy |
D2 |
Oct. 14, 2021, 1:50 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
204800 |
|
|
131941037 |
Mercuryyy |
D2 |
Oct. 14, 2021, 1:18 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
204800 |
|
|
131937987 |
Paqis |
D2 |
Oct. 14, 2021, 12:53 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
204800 |
|
|
131904746 |
222IQ |
D2 |
Oct. 14, 2021, 7:23 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
307200 |
|
|
131984671 |
Rainer1116 |
D2 |
Oct. 15, 2021, 1:10 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
15 |
512000 |
|
|
131970771 |
wadawwadawd |
D2 |
Oct. 14, 2021, 6:43 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
102400 |
|
|
131955869 |
piaobozhe |
D2 |
Oct. 14, 2021, 3:43 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
102400 |
|
|
131955009 |
harsh_67 |
D2 |
Oct. 14, 2021, 3:35 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
204800 |
|
|
131954881 |
2401544870 |
D2 |
Oct. 14, 2021, 3:33 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
204800 |
|
|
131953630 |
dark-jk |
D2 |
Oct. 14, 2021, 3:20 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
204800 |
|
|
131943481 |
GennadyTran |
D2 |
Oct. 14, 2021, 1:39 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
204800 |
|
|
131930916 |
chu65536 |
D2 |
Oct. 14, 2021, 11:50 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
204800 |
|
|
131926504 |
Invisible_Shadow |
D2 |
Oct. 14, 2021, 11:10 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
204800 |
|
|
131922406 |
Murtaza1112 |
D2 |
Oct. 14, 2021, 10:31 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
204800 |
|
|
131909448 |
I_Love_YrNameCouldBeHere |
D2 |
Oct. 14, 2021, 8:09 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
15 |
204800 |
|
|
131957081 |
aryan57 |
D2 |
Oct. 14, 2021, 3:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
15 |
0 |
|
|
131956331 |
mysteri0us7 |
D2 |
Oct. 14, 2021, 3:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
15 |
0 |
|
|
131907157 |
Baekho_Railgun |
D2 |
Oct. 14, 2021, 7:46 a.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
15 |
0 |
|
|
131931910 |
iamnifer |
D2 |
Oct. 14, 2021, 11:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
15 |
102400 |
|
|
131931253 |
iamnifer |
D2 |
Oct. 14, 2021, 11:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
15 |
102400 |
|
|
131928076 |
Robin |
D2 |
Oct. 14, 2021, 11:24 a.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
15 |
204800 |
|
|
131912527 |
binarycopycode |
D2 |
Oct. 14, 2021, 8:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
15 |
3174400 |
|
|
131914669 |
achvanov |
D2 |
Oct. 14, 2021, 9:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
15 |
10137600 |
|
|
131996013 |
ultimate_pal |
D2 |
Oct. 15, 2021, 5:49 a.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
31 |
0 |
|
|
131978585 |
devk_232 |
D2 |
Oct. 14, 2021, 9:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
59 |
31 |
0 |
|
|
131978298 |
glebsamsonov |
D2 |
Oct. 14, 2021, 9:07 p.m. |
OK |
Go |
TESTS |
59 |
31 |
102400 |
|
|
131941349 |
MrOtter |
D2 |
Oct. 14, 2021, 1:20 p.m. |
OK |
Java 11 |
TESTS |
59 |
202 |
0 |
|
|
131941074 |
MrOtter |
D2 |
Oct. 14, 2021, 1:18 p.m. |
OK |
Java 11 |
TESTS |
59 |
202 |
0 |
|
|
131930959 |
SaberXpro |
D2 |
Oct. 14, 2021, 11:51 a.m. |
OK |
Java 11 |
TESTS |
59 |
202 |
0 |
|
|
131928307 |
ArchitSharma |
D2 |
Oct. 14, 2021, 11:26 a.m. |
OK |
Java 11 |
TESTS |
59 |
233 |
0 |
|
|
131928075 |
bittubittu |
D2 |
Oct. 14, 2021, 11:24 a.m. |
OK |
Java 11 |
TESTS |
59 |
233 |
0 |
|
|
131912543 |
ak_ankit |
D2 |
Oct. 14, 2021, 8:47 a.m. |
OK |
Java 11 |
TESTS |
59 |
249 |
0 |
|
|
131956609 |
qwerty12345qwerty |
D2 |
Oct. 14, 2021, 3:51 p.m. |
OK |
Java 11 |
TESTS |
59 |
296 |
0 |
|
|
131940783 |
MrOtter |
D2 |
Oct. 14, 2021, 1:16 p.m. |
OK |
Java 11 |
TESTS |
59 |
592 |
0 |
|
|
131990632 |
the_unseen |
D2 |
Oct. 15, 2021, 3:56 a.m. |
OK |
Java 11 |
TESTS |
59 |
889 |
0 |
|
|
131948300 |
Ad-007 |
D2 |
Oct. 14, 2021, 2:23 p.m. |
OK |
Java 8 |
TESTS |
59 |
109 |
0 |
|
|
131921448 |
TheSawan |
D2 |
Oct. 14, 2021, 10:21 a.m. |
OK |
Java 8 |
TESTS |
59 |
139 |
0 |
|
|
131992086 |
invincible777 |
D2 |
Oct. 15, 2021, 4:28 a.m. |
OK |
Java 8 |
TESTS |
59 |
155 |
0 |
|
|
131971711 |
piyush33patel |
D2 |
Oct. 14, 2021, 6:57 p.m. |
OK |
Java 8 |
TESTS |
59 |
171 |
0 |
|
|
131920894 |
linxiaotian |
D2 |
Oct. 14, 2021, 10:16 a.m. |
OK |
Kotlin 1.4 |
TESTS |
59 |
280 |
1433600 |
|
|
131973739 |
1024mb |
D2 |
Oct. 14, 2021, 7:32 p.m. |
OK |
MS C++ 2017 |
TESTS |
59 |
997 |
24064000 |
|
|
131914371 |
sushmanth.dampur8780 |
D2 |
Oct. 14, 2021, 9:07 a.m. |
OK |
PyPy 3 |
TESTS |
59 |
140 |
2662400 |
|
|
131945922 |
godsdice |
D2 |
Oct. 14, 2021, 2:01 p.m. |
OK |
PyPy 3 |
TESTS |
59 |
155 |
4505600 |
|
|
131913800 |
s_prateek26 |
D2 |
Oct. 14, 2021, 9 a.m. |
OK |
PyPy 3 |
TESTS |
59 |
171 |
4812800 |
|
|
131918503 |
batnik |
D2 |
Oct. 14, 2021, 9:50 a.m. |
OK |
PyPy 3 |
TESTS |
59 |
186 |
9420800 |
|
|
131945927 |
nicku123 |
D2 |
Oct. 14, 2021, 2:01 p.m. |
OK |
PyPy 3 |
TESTS |
59 |
187 |
3379200 |
|
|
131913750 |
SPD_9X2 |
D2 |
Oct. 14, 2021, 8:59 a.m. |
OK |
PyPy 3 |
TESTS |
59 |
187 |
6656000 |
|
|
131912845 |
zayn. |
D2 |
Oct. 14, 2021, 8:50 a.m. |
OK |
PyPy 3 |
TESTS |
59 |
218 |
8396800 |
|
|
131909720 |
_____a____ |
D2 |
Oct. 14, 2021, 8:11 a.m. |
OK |
PyPy 3 |
TESTS |
59 |
280 |
4710400 |
|
|
131990083 |
WOIOT |
D2 |
Oct. 15, 2021, 3:42 a.m. |
OK |
PyPy 3 |
TESTS |
59 |
296 |
9728000 |
|
|
131957194 |
Mai_hoo_kaun |
D2 |
Oct. 14, 2021, 3:57 p.m. |
OK |
PyPy 3 |
TESTS |
59 |
514 |
7168000 |
|
|
131966301 |
freakbuoyancy |
D2 |
Oct. 14, 2021, 5:42 p.m. |
OK |
PyPy 3-64 |
TESTS |
59 |
124 |
6144000 |
|
|
131978079 |
KeiTsukishima |
D2 |
Oct. 14, 2021, 9:01 p.m. |
OK |
PyPy 3-64 |
TESTS |
59 |
295 |
16384000 |
|
|
131942316 |
sh1194 |
D2 |
Oct. 14, 2021, 1:29 p.m. |
OK |
Python 3 |
TESTS |
59 |
280 |
0 |
|
|
131941744 |
sh1194 |
D2 |
Oct. 14, 2021, 1:24 p.m. |
OK |
Python 3 |
TESTS |
59 |
280 |
0 |
|
|
131939341 |
Spheniscine |
D2 |
Oct. 14, 2021, 1:03 p.m. |
OK |
Rust |
TESTS |
59 |
31 |
307200 |
|
|
131904955 |
sansen |
D2 |
Oct. 14, 2021, 7:25 a.m. |
OK |
Rust |
TESTS |
59 |
46 |
18022400 |
|
|
remove filters
Back to search problems