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 has unusual memory constraint. At evening, Igor and Zhenya the financiers became boring, so they decided to play a game. They prepared n papers with the income of some company for some time periods. Note that the income can be positive, zero or negative. Igor and Zhenya placed the papers in a row and decided to take turns making moves. Igor will take the papers from the left side, Zhenya will take the papers from the right side. Igor goes first and takes 1 or 2 (on his choice) papers from the left. Then, on each turn a player can take k or k xe2 x80 x89+ xe2 x80 x891 papers from his side if the opponent took exactly k papers in the previous turn. Players can't skip moves. The game ends when there are no papers left, or when some of the players can't make a move. Your task is to determine the difference between the sum of incomes on the papers Igor took and the sum of incomes on the papers Zhenya took, assuming both players play optimally. Igor wants to maximize the difference, Zhenya wants to minimize it. The first line contains single positive integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x894000) -- the number of papers. The second line contains n integers a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an ( xe2 x80 x89- xe2 x80 x89105 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105), where ai is the income on the i-th paper from the left. Print the difference between the sum of incomes on the papers Igor took and the sum of incomes on the papers Zhenya took, assuming both players play optimally. Igor wants to maximize the difference, Zhenya wants to minimize it. In the first example it's profitable for Igor to take two papers from the left to have the sum of the incomes equal to 4. Then Zhenya wouldn't be able to make a move since there would be only one paper, and he would be able to take only 2 or 3.. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
23286273 |
ngattaro1 |
F |
Dec. 25, 2016, 7:08 a.m. |
OK |
FPC |
TESTS |
30 |
655 |
527872000 |
|
2600 |
25306534 |
ngattaro1 |
F |
March 7, 2017, 2:45 a.m. |
OK |
FPC |
TESTS |
30 |
716 |
533708800 |
|
2600 |
23342184 |
ngattaro1 |
F |
Dec. 26, 2016, 2:35 p.m. |
OK |
FPC |
TESTS |
30 |
764 |
533708800 |
|
2600 |
22420248 |
ZJZNKU |
F |
Nov. 23, 2016, 9:45 a.m. |
OK |
GNU C++ |
TESTS |
30 |
233 |
78950400 |
|
2600 |
26631801 |
jiyutian |
F |
April 24, 2017, 2:29 a.m. |
OK |
GNU C++ |
TESTS |
30 |
280 |
132403200 |
|
2600 |
26631777 |
jiyutian |
F |
April 24, 2017, 2:26 a.m. |
OK |
GNU C++ |
TESTS |
30 |
280 |
262246400 |
|
2600 |
23051525 |
Kuro_DD |
F |
Dec. 17, 2016, 4 p.m. |
OK |
GNU C++ |
TESTS |
30 |
295 |
181043200 |
|
2600 |
26631770 |
jiyutian |
F |
April 24, 2017, 2:25 a.m. |
OK |
GNU C++ |
TESTS |
30 |
295 |
263065600 |
|
2600 |
23465115 |
FoolPerson |
F |
Dec. 31, 2016, 7:28 a.m. |
OK |
GNU C++ |
TESTS |
30 |
296 |
162611200 |
|
2600 |
26631784 |
jiyutian |
F |
April 24, 2017, 2:27 a.m. |
OK |
GNU C++ |
TESTS |
30 |
311 |
262246400 |
|
2600 |
23332005 |
jzymts |
F |
Dec. 26, 2016, 3:38 a.m. |
OK |
GNU C++ |
TESTS |
30 |
312 |
202956800 |
|
2600 |
35551206 |
vjudge5 |
F |
Feb. 21, 2018, 2:53 p.m. |
OK |
GNU C++ |
TESTS |
30 |
343 |
187904000 |
|
2600 |
35576360 |
vjudge4 |
F |
Feb. 22, 2018, 2:58 p.m. |
OK |
GNU C++ |
TESTS |
30 |
343 |
403251200 |
|
2600 |
40983366 |
ReaLNero1 |
F |
July 30, 2018, 6:50 p.m. |
OK |
GNU C++11 |
TESTS |
30 |
77 |
6246400 |
|
2600 |
22397498 |
lzr010506 |
F |
Nov. 22, 2016, 6:06 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
109 |
257843200 |
|
2600 |
22504994 |
codemasterisme |
F |
Nov. 26, 2016, 9:21 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
140 |
128614400 |
|
2600 |
22869843 |
Hikari9 |
F |
Dec. 11, 2016, 3:53 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
140 |
134246400 |
|
2600 |
22377360 |
BlinkingStar |
F |
Nov. 21, 2016, 6:07 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
155 |
128614400 |
|
2600 |
34279962 |
MAMBA |
F |
Jan. 18, 2018, 3:35 p.m. |
OK |
GNU C++11 |
TESTS |
30 |
187 |
75468800 |
|
2600 |
26325159 |
Meowl |
F |
April 12, 2017, 7:57 p.m. |
OK |
GNU C++11 |
TESTS |
30 |
202 |
137625600 |
|
2600 |
35801198 |
bill_kondo |
F |
March 1, 2018, 3:46 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
233 |
196710400 |
|
2600 |
49109788 |
Logey |
F |
Jan. 28, 2019, 2:30 p.m. |
OK |
GNU C++11 |
TESTS |
30 |
264 |
225792000 |
|
2600 |
45546191 |
NotBessieTheCow |
F |
Nov. 11, 2018, 1:29 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
264 |
385740800 |
|
2600 |
23823181 |
mihai.alpha |
F |
Jan. 14, 2017, 9:28 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
93 |
131072000 |
|
2600 |
22396545 |
NiroBC |
F |
Nov. 22, 2016, 4:34 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
108 |
256614400 |
|
2600 |
38061503 |
vjudge3 |
F |
May 9, 2018, 5:32 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
202 |
76697600 |
|
2600 |
46051775 |
ArshiaDadras |
F |
Nov. 22, 2018, 8 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
202 |
78643200 |
|
2600 |
59377225 |
JustForRating007 |
F |
Aug. 23, 2019, 11:07 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
233 |
225587200 |
|
2600 |
25867883 |
wuliuyi |
F |
March 28, 2017, 7:50 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
265 |
100556800 |
|
2600 |
68891824 |
balbit |
F |
Jan. 16, 2020, 2:40 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
280 |
115916800 |
|
2600 |
31176492 |
Sahaand |
F |
Oct. 9, 2017, 7:43 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
295 |
181043200 |
|
2600 |
22467243 |
PItS |
F |
Nov. 24, 2016, 1:12 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
296 |
157388800 |
|
2600 |
32362915 |
Emsawy |
F |
Nov. 16, 2017, 6:28 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
312 |
134553600 |
|
2600 |
69243043 |
Mohammad.H915 |
F |
Jan. 21, 2020, 12:04 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
280 |
205619200 |
|
2600 |
63404903 |
Ari |
F |
Oct. 25, 2019, 7:52 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
327 |
321228800 |
|
2600 |
57721596 |
vjudge3 |
F |
July 25, 2019, 5:38 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
358 |
200704000 |
|
2600 |
39439115 |
vjudge2 |
F |
June 20, 2018, 2:52 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
358 |
362393600 |
|
2600 |
44026432 |
NiceBaseballCoder |
F |
Oct. 9, 2018, 8:11 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
389 |
283955200 |
|
2600 |
68677769 |
YaoBIG |
F |
Jan. 12, 2020, 7:33 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
389 |
381747200 |
|
2600 |
55610187 |
vjudge1 |
F |
June 16, 2019, 5:08 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
420 |
320921600 |
|
2600 |
47303539 |
TTNTTC |
F |
Dec. 20, 2018, 3:28 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
436 |
372428800 |
|
2600 |
48181268 |
Qingyu |
F |
Jan. 10, 2019, 12:38 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
452 |
372633600 |
|
2600 |
66808926 |
jhzjk |
F |
Dec. 14, 2019, 12:17 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
483 |
421273600 |
|
2600 |
23018831 |
PugachAG |
F |
Dec. 15, 2016, 9:16 p.m. |
OK |
Go |
TESTS |
30 |
686 |
296755200 |
|
2600 |
22841072 |
roastbeef |
F |
Dec. 9, 2016, 6:21 p.m. |
OK |
Java 8 |
TESTS |
30 |
577 |
476979200 |
|
2600 |
22402483 |
Megabyte |
F |
Nov. 22, 2016, 12:05 p.m. |
OK |
Java 8 |
TESTS |
30 |
1060 |
474931200 |
|
2600 |
remove filters
Back to search problems