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"Iahub and Sorin are the best competitive programmers in their town. However, they can't both qualify to an important contest. The selection will be made with the help of a single problem. Blatnatalag, a friend of Iahub, managed to get hold of the problem before the contest. Because he wants to make sure Iahub will be the one qualified, he tells Iahub the following task. You're given an (1-based) array a with n elements. Let's define function f(i, xe2 x80 x89j) (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89i, xe2 x80 x89j xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n) as (i xe2 x80 x89- xe2 x80 x89j)2 xe2 x80 x89+ xe2 x80 x89g(i, xe2 x80 x89j)2. Function g is calculated by the following pseudo-code: Find a value mini xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89j f(i, xe2 x80 x89j). Probably by now Iahub already figured out the solution to this problem. Can you? The first line of input contains a single integer n (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100000). Next line contains n integers a[1], a[2], ..., a[n] ( xe2 x80 x89- xe2 x80 x89104 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89a[i] xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89104). Output a single integer -- the value of mini xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89j f(i, xe2 x80 x89j)."... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
6599996 |
Gassa |
D |
May 11, 2014, 9:39 p.m. |
OK |
D |
TESTS |
47 |
702 |
512000 |
|
2100 |
6596577 |
Gassa |
D |
May 11, 2014, 5:32 p.m. |
OK |
D |
TESTS |
46 |
1482 |
512000 |
|
2100 |
6601279 |
ruban |
D |
May 12, 2014, 4:09 a.m. |
OK |
Delphi |
TESTS |
47 |
156 |
64000000 |
|
2100 |
6596961 |
IgorL |
D |
May 11, 2014, 5:36 p.m. |
OK |
Delphi |
TESTS |
46 |
499 |
819200 |
|
2100 |
6599398 |
Maestr0 |
D |
May 11, 2014, 7:54 p.m. |
OK |
Delphi |
TESTS |
47 |
873 |
8089600 |
|
2100 |
6599408 |
Maestr0 |
D |
May 11, 2014, 7:55 p.m. |
OK |
Delphi |
TESTS |
47 |
888 |
8089600 |
|
2100 |
6599390 |
Maestr0 |
D |
May 11, 2014, 7:53 p.m. |
OK |
Delphi |
TESTS |
47 |
920 |
8089600 |
|
2100 |
6599389 |
Maestr0 |
D |
May 11, 2014, 7:53 p.m. |
OK |
Delphi |
TESTS |
47 |
936 |
8089600 |
|
2100 |
6599387 |
Maestr0 |
D |
May 11, 2014, 7:53 p.m. |
OK |
Delphi |
TESTS |
47 |
967 |
8089600 |
|
2100 |
6599369 |
Maestr0 |
D |
May 11, 2014, 7:51 p.m. |
OK |
Delphi |
TESTS |
47 |
1076 |
8089600 |
|
2100 |
6595171 |
Alex_2oo8 |
D |
May 11, 2014, 5:13 p.m. |
OK |
Delphi |
TESTS |
46 |
1934 |
819200 |
|
2100 |
7201095 |
DaibaNana |
D |
July 22, 2014, 9:35 a.m. |
OK |
FPC |
TESTS |
47 |
46 |
1638400 |
|
2100 |
6603398 |
weizhaohui |
D |
May 12, 2014, 12:56 p.m. |
OK |
FPC |
TESTS |
47 |
46 |
1638400 |
|
2100 |
6733769 |
yubaby |
D |
May 29, 2014, 8:53 a.m. |
OK |
FPC |
TESTS |
47 |
62 |
2048000 |
|
2100 |
6598327 |
valeriy.stromov |
D |
May 11, 2014, 6:35 p.m. |
OK |
FPC |
TESTS |
46 |
62 |
3276800 |
|
2100 |
6595960 |
xurenzhe |
D |
May 11, 2014, 5:24 p.m. |
OK |
FPC |
TESTS |
46 |
171 |
100966400 |
|
2100 |
6778516 |
ghostmath |
D |
June 2, 2014, 1:39 a.m. |
OK |
FPC |
TESTS |
47 |
187 |
2048000 |
|
2100 |
6778521 |
ghostmath |
D |
June 2, 2014, 1:40 a.m. |
OK |
FPC |
TESTS |
47 |
202 |
2048000 |
|
2100 |
6778504 |
ghostmath |
D |
June 2, 2014, 1:35 a.m. |
OK |
FPC |
TESTS |
47 |
202 |
2048000 |
|
2100 |
7187355 |
imhereonlyforcookies |
D |
July 20, 2014, 2:54 p.m. |
OK |
FPC |
TESTS |
47 |
202 |
13619200 |
|
2100 |
8331264 |
ghostmath |
D |
Oct. 20, 2014, 1:39 p.m. |
OK |
FPC |
TESTS |
47 |
217 |
2764800 |
|
2100 |
6599775 |
fhlasek |
D |
May 11, 2014, 8:56 p.m. |
OK |
GNU C |
TESTS |
47 |
842 |
409600 |
|
2100 |
17197975 |
SanSiroWaltz |
D |
April 7, 2016, 1:54 a.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
4608000 |
|
2100 |
6597823 |
ikbal |
D |
May 11, 2014, 6:20 p.m. |
OK |
GNU C++ |
TESTS |
46 |
46 |
819200 |
|
2100 |
6657856 |
aaaaajack |
D |
May 19, 2014, 1:49 p.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
1228800 |
|
2100 |
6784679 |
Lisa_David |
D |
June 3, 2014, 2:59 a.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
1331200 |
|
2100 |
6603785 |
liuq901 |
D |
May 12, 2014, 1:43 p.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
1536000 |
|
2100 |
6620761 |
BekzhanKassenov |
D |
May 15, 2014, 12:33 p.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
1638400 |
|
2100 |
6620718 |
BekzhanKassenov |
D |
May 15, 2014, 12:23 p.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
1638400 |
|
2100 |
6610586 |
sunshuo |
D |
May 13, 2014, 2:50 p.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
1638400 |
|
2100 |
6616231 |
iscsi |
D |
May 14, 2014, 3:52 p.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
1638400 |
|
2100 |
6989580 |
Mothaiba |
D |
July 1, 2014, 3:28 a.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
1638400 |
|
2100 |
6600358 |
atablash |
D |
May 11, 2014, 11:34 p.m. |
OK |
GNU C++0x |
TESTS |
47 |
30 |
1638400 |
|
2100 |
6602971 |
atablash |
D |
May 12, 2014, 11:18 a.m. |
OK |
GNU C++0x |
TESTS |
47 |
31 |
1638400 |
|
2100 |
6600359 |
atablash |
D |
May 11, 2014, 11:35 p.m. |
OK |
GNU C++0x |
TESTS |
47 |
31 |
1638400 |
|
2100 |
6597731 |
ZhouYuChen |
D |
May 11, 2014, 6:17 p.m. |
OK |
GNU C++0x |
TESTS |
46 |
46 |
1228800 |
|
2100 |
6621093 |
savinov |
D |
May 15, 2014, 1:22 p.m. |
OK |
GNU C++0x |
TESTS |
47 |
46 |
2457600 |
|
2100 |
6621110 |
savinov |
D |
May 15, 2014, 1:25 p.m. |
OK |
GNU C++0x |
TESTS |
47 |
46 |
2457600 |
|
2100 |
6594796 |
mukel |
D |
May 11, 2014, 5:07 p.m. |
OK |
GNU C++0x |
TESTS |
46 |
46 |
3174400 |
|
2100 |
6597825 |
mukel |
D |
May 11, 2014, 6:20 p.m. |
OK |
GNU C++0x |
TESTS |
46 |
46 |
3174400 |
|
2100 |
6594343 |
evima |
D |
May 11, 2014, 5:01 p.m. |
OK |
GNU C++0x |
TESTS |
46 |
46 |
4403200 |
|
2100 |
9044760 |
xneby |
D |
Dec. 8, 2014, 10:58 p.m. |
OK |
GNU C++0x |
TESTS |
47 |
46 |
5836800 |
|
2100 |
58395778 |
rainboy |
D |
Aug. 6, 2019, 3:34 p.m. |
OK |
GNU C11 |
TESTS |
47 |
46 |
1228800 |
|
2100 |
53171826 |
about |
D |
April 22, 2019, 10:30 p.m. |
OK |
GNU C11 |
TESTS |
47 |
78 |
5734400 |
|
2100 |
58394959 |
rainboy |
D |
Aug. 6, 2019, 3:14 p.m. |
OK |
GNU C11 |
TESTS |
47 |
202 |
819200 |
|
2100 |
58916885 |
C1ariS |
D |
Aug. 16, 2019, 3:22 p.m. |
OK |
GNU C11 |
TESTS |
47 |
249 |
32051200 |
|
2100 |
27926297 |
yah01 |
D |
June 20, 2017, 1:41 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
3686400 |
|
2100 |
32714025 |
Hamzqq9 |
D |
Nov. 27, 2017, 12:08 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
3993600 |
|
2100 |
24408748 |
ShiroyashaGintoki |
D |
Feb. 3, 2017, 11:35 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
4096000 |
|
2100 |
16768434 |
NiKS001 |
D |
March 17, 2016, 5:10 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
716800 |
|
2100 |
15158775 |
aditya1495 |
D |
Jan. 2, 2016, 1:20 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
716800 |
|
2100 |
16260698 |
Nike_VML |
D |
Feb. 21, 2016, 2:39 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
1638400 |
|
2100 |
12412256 |
cq_phqg |
D |
Aug. 8, 2015, 9:03 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
2457600 |
|
2100 |
19457057 |
chenxun |
D |
July 28, 2016, 8:11 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
2457600 |
|
2100 |
11705494 |
saichandu6 |
D |
June 22, 2015, 6:36 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
2662400 |
|
2100 |
18604405 |
Svyat |
D |
June 19, 2016, 7:43 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
3174400 |
|
2100 |
34591513 |
Liwj |
D |
Jan. 27, 2018, 1:59 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
46 |
4300800 |
|
2100 |
34064686 |
hamayanhamayan |
D |
Jan. 10, 2018, 8:16 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
46 |
5017600 |
|
2100 |
34064791 |
hamayanhamayan |
D |
Jan. 10, 2018, 8:22 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
46 |
5017600 |
|
2100 |
67140675 |
Nson |
D |
Dec. 18, 2019, 6:37 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
61 |
1638400 |
|
2100 |
21766645 |
namai |
D |
Oct. 25, 2016, 8:41 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
61 |
1740800 |
|
2100 |
34064836 |
hamayanhamayan |
D |
Jan. 10, 2018, 8:25 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
61 |
5017600 |
|
2100 |
28396477 |
LeMieux |
D |
July 10, 2017, 2:12 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
61 |
5120000 |
|
2100 |
68155489 |
MakeSPGreatAgain |
D |
Jan. 4, 2020, 8:47 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
61 |
5529600 |
|
2100 |
34064775 |
hamayanhamayan |
D |
Jan. 10, 2018, 8:21 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
61 |
7680000 |
|
2100 |
55210690 |
misael |
D |
June 6, 2019, 2:30 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
62 |
921600 |
|
2100 |
58914939 |
RaFiN_ |
D |
Aug. 16, 2019, 2:34 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
46 |
4505600 |
|
2100 |
57181359 |
snjumaheshwari98 |
D |
July 17, 2019, 7:21 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
61 |
1331200 |
|
2100 |
65721576 |
CodingKnight |
D |
Nov. 25, 2019, 7:25 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
61 |
1638400 |
|
2100 |
54782202 |
aryaman |
D |
May 28, 2019, 11:22 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
62 |
1331200 |
|
2100 |
63773365 |
tinca_matei |
D |
Oct. 30, 2019, 8:44 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
62 |
1638400 |
|
2100 |
65719210 |
CodingKnight |
D |
Nov. 25, 2019, 6:08 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
62 |
1638400 |
|
2100 |
62422773 |
LucaSeri |
D |
Oct. 12, 2019, 1:25 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
62 |
2355200 |
|
2100 |
55838181 |
sinus_070 |
D |
June 20, 2019, 4:30 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
62 |
2457600 |
|
2100 |
62422809 |
LucaSeri |
D |
Oct. 12, 2019, 1:26 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
62 |
2457600 |
|
2100 |
47446240 |
spartan_117 |
D |
Dec. 24, 2018, 6:25 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
62 |
3379200 |
|
2100 |
6606066 |
OutSide |
D |
May 12, 2014, 7:05 p.m. |
OK |
Go |
TESTS |
47 |
1575 |
819200 |
|
2100 |
6606027 |
OutSide |
D |
May 12, 2014, 6:55 p.m. |
OK |
Go |
TESTS |
47 |
1575 |
819200 |
|
2100 |
6606041 |
OutSide |
D |
May 12, 2014, 6:58 p.m. |
OK |
Go |
TESTS |
47 |
1700 |
819200 |
|
2100 |
6606060 |
OutSide |
D |
May 12, 2014, 7:04 p.m. |
OK |
Go |
TESTS |
47 |
1809 |
819200 |
|
2100 |
6600084 |
Lewin |
D |
May 11, 2014, 10:06 p.m. |
OK |
Java 6 |
TESTS |
47 |
249 |
204800 |
|
2100 |
6605582 |
Guliash |
D |
May 12, 2014, 5:24 p.m. |
OK |
Java 7 |
TESTS |
47 |
155 |
614400 |
|
2100 |
6619813 |
fetetriste |
D |
May 15, 2014, 9:50 a.m. |
OK |
Java 7 |
TESTS |
47 |
218 |
409600 |
|
2100 |
6619585 |
fetetriste |
D |
May 15, 2014, 9:06 a.m. |
OK |
Java 7 |
TESTS |
47 |
234 |
409600 |
|
2100 |
6589203 |
uwi |
D |
May 11, 2014, 3:58 p.m. |
OK |
Java 7 |
TESTS |
46 |
249 |
102400 |
|
2100 |
6591224 |
ocozalp |
D |
May 11, 2014, 4:21 p.m. |
OK |
Java 7 |
TESTS |
46 |
265 |
204800 |
|
2100 |
8584456 |
qingwen |
D |
Nov. 6, 2014, 6:22 a.m. |
OK |
Java 7 |
TESTS |
47 |
295 |
102400 |
|
2100 |
7685618 |
hama-du |
D |
Sept. 5, 2014, 3:46 a.m. |
OK |
Java 7 |
TESTS |
47 |
296 |
204800 |
|
2100 |
6608592 |
KNIGHT0X300 |
D |
May 13, 2014, 8:30 a.m. |
OK |
Java 7 |
TESTS |
47 |
311 |
307200 |
|
2100 |
10634122 |
Sumeet.Varma |
D |
April 8, 2015, 7:33 p.m. |
OK |
Java 7 |
TESTS |
47 |
373 |
0 |
|
2100 |
6667410 |
Junior94 |
D |
May 21, 2014, 1:42 p.m. |
OK |
Java 7 |
TESTS |
47 |
421 |
102400 |
|
2100 |
25882380 |
sweiss |
D |
March 28, 2017, 7:31 p.m. |
OK |
Java 8 |
TESTS |
47 |
171 |
22630400 |
|
2100 |
46664025 |
flyman3046 |
D |
Dec. 5, 2018, 10:35 p.m. |
OK |
Java 8 |
TESTS |
47 |
217 |
1740800 |
|
2100 |
23020320 |
lydxlx |
D |
Dec. 16, 2016, 12:07 a.m. |
OK |
Java 8 |
TESTS |
47 |
233 |
0 |
|
2100 |
12250815 |
afrizal |
D |
July 28, 2015, 10:51 a.m. |
OK |
Java 8 |
TESTS |
47 |
233 |
0 |
|
2100 |
10992843 |
alibaba |
D |
May 4, 2015, 5:50 a.m. |
OK |
Java 8 |
TESTS |
47 |
233 |
0 |
|
2100 |
58930593 |
MohamedK |
D |
Aug. 16, 2019, 11:58 p.m. |
OK |
Java 8 |
TESTS |
47 |
234 |
0 |
|
2100 |
14180519 |
Sumeet.Varma |
D |
Nov. 10, 2015, 6 a.m. |
OK |
Java 8 |
TESTS |
47 |
234 |
0 |
|
2100 |
58872591 |
MohamedK |
D |
Aug. 15, 2019, 4:09 p.m. |
OK |
Java 8 |
TESTS |
47 |
249 |
0 |
|
2100 |
37575114 |
prabhat236218 |
D |
April 24, 2018, 2:14 p.m. |
OK |
Java 8 |
TESTS |
47 |
249 |
73318400 |
|
2100 |
39686219 |
Nesrin |
D |
June 26, 2018, 9:18 p.m. |
OK |
Java 8 |
TESTS |
47 |
264 |
0 |
|
2100 |
6602216 |
tangchuanxin |
D |
May 12, 2014, 7:57 a.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
1433600 |
|
2100 |
10918449 |
vjudge1 |
D |
April 28, 2015, 11:56 a.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
3686400 |
|
2100 |
10918432 |
nbybyyby |
D |
April 28, 2015, 11:55 a.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
3686400 |
|
2100 |
6642713 |
AnnKats93 |
D |
May 17, 2014, 1:03 p.m. |
OK |
MS C++ |
TESTS |
47 |
46 |
3072000 |
|
2100 |
6614507 |
Krainov_Dmitry |
D |
May 14, 2014, 11:07 a.m. |
OK |
MS C++ |
TESTS |
47 |
61 |
1638400 |
|
2100 |
6615491 |
Rebryk |
D |
May 14, 2014, 1:44 p.m. |
OK |
MS C++ |
TESTS |
47 |
62 |
1433600 |
|
2100 |
6615166 |
robots.txt |
D |
May 14, 2014, 12:52 p.m. |
OK |
MS C++ |
TESTS |
47 |
62 |
2457600 |
|
2100 |
6615140 |
robots.txt |
D |
May 14, 2014, 12:48 p.m. |
OK |
MS C++ |
TESTS |
47 |
62 |
2662400 |
|
2100 |
6596456 |
Alexey_Nikitin |
D |
May 11, 2014, 5:31 p.m. |
OK |
MS C++ |
TESTS |
46 |
62 |
3072000 |
|
2100 |
6611385 |
cvm |
D |
May 13, 2014, 6:05 p.m. |
OK |
MS C++ |
TESTS |
47 |
62 |
3584000 |
|
2100 |
67209207 |
pikachan14 |
D |
Dec. 19, 2019, 1:28 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
327 |
13619200 |
|
2100 |
6731146 |
Darooha |
D |
May 29, 2014, 2:57 a.m. |
OK |
Ocaml |
TESTS |
47 |
358 |
12083200 |
|
2100 |
54783022 |
pajenegod |
D |
May 29, 2019, 12:44 a.m. |
OK |
PyPy 2 |
TESTS |
47 |
389 |
17715200 |
|
2100 |
11069115 |
Dremov |
D |
May 11, 2015, 10:50 a.m. |
OK |
PyPy 2 |
TESTS |
47 |
967 |
13619200 |
|
2100 |
55104979 |
pajenegod |
D |
June 5, 2019, 1:15 a.m. |
OK |
PyPy 2 |
TESTS |
47 |
1996 |
5222400 |
|
2100 |
55104892 |
pajenegod |
D |
June 5, 2019, 1:08 a.m. |
OK |
PyPy 2 |
TESTS |
47 |
1996 |
5222400 |
|
2100 |
42741236 |
xuanquang1999 |
D |
Sept. 10, 2018, 4:23 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
685 |
16384000 |
|
2100 |
remove filters
Back to search problems