# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
70470 |
2018-08-23T02:29:01 Z |
Diuven |
None (JOI14_ho_t3) |
C++14 |
|
205 ms |
14096 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=100010, inf=2e9;
int n, A[2*MX];
ll ans=0;
ll S[2*MX];
ll solve(int t){
int s=0, e=n;
while(s<e){
int m=(s+e+1)/2;
int ss=m, ee=n;
while(ss<ee){
int mm=(ss+ee)/2;
if(S[t+mm]-S[t+m]>=S[t+m]-S[t]) ee=mm;
else ss=mm+1;
}
if(S[t+ss]-S[t+m]>=S[t+m]-S[t] && S[t+n]-S[t+ss]>=S[t+m]-S[t]) s=m;
else e=m-1;
}
return S[t+s]-S[t];
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n;
for(int i=1; i<=n; i++) cin>>A[i];
for(int i=1; i<=n; i++) A[i+n]=A[i];
for(int i=1; i<=2*n; i++) S[i]=S[i-1]+A[i];
for(int i=1; i<=n; i++){
ans=max(ans, solve(i-1));
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
440 KB |
Output is correct |
3 |
Correct |
3 ms |
472 KB |
Output is correct |
4 |
Correct |
2 ms |
572 KB |
Output is correct |
5 |
Correct |
3 ms |
572 KB |
Output is correct |
6 |
Correct |
3 ms |
572 KB |
Output is correct |
7 |
Correct |
3 ms |
572 KB |
Output is correct |
8 |
Correct |
3 ms |
704 KB |
Output is correct |
9 |
Correct |
2 ms |
704 KB |
Output is correct |
10 |
Correct |
2 ms |
704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
440 KB |
Output is correct |
3 |
Correct |
3 ms |
472 KB |
Output is correct |
4 |
Correct |
2 ms |
572 KB |
Output is correct |
5 |
Correct |
3 ms |
572 KB |
Output is correct |
6 |
Correct |
3 ms |
572 KB |
Output is correct |
7 |
Correct |
3 ms |
572 KB |
Output is correct |
8 |
Correct |
3 ms |
704 KB |
Output is correct |
9 |
Correct |
2 ms |
704 KB |
Output is correct |
10 |
Correct |
2 ms |
704 KB |
Output is correct |
11 |
Correct |
4 ms |
824 KB |
Output is correct |
12 |
Correct |
3 ms |
824 KB |
Output is correct |
13 |
Correct |
3 ms |
832 KB |
Output is correct |
14 |
Correct |
2 ms |
832 KB |
Output is correct |
15 |
Correct |
3 ms |
844 KB |
Output is correct |
16 |
Correct |
2 ms |
844 KB |
Output is correct |
17 |
Correct |
3 ms |
844 KB |
Output is correct |
18 |
Correct |
3 ms |
844 KB |
Output is correct |
19 |
Correct |
3 ms |
844 KB |
Output is correct |
20 |
Correct |
3 ms |
972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
440 KB |
Output is correct |
3 |
Correct |
3 ms |
472 KB |
Output is correct |
4 |
Correct |
2 ms |
572 KB |
Output is correct |
5 |
Correct |
3 ms |
572 KB |
Output is correct |
6 |
Correct |
3 ms |
572 KB |
Output is correct |
7 |
Correct |
3 ms |
572 KB |
Output is correct |
8 |
Correct |
3 ms |
704 KB |
Output is correct |
9 |
Correct |
2 ms |
704 KB |
Output is correct |
10 |
Correct |
2 ms |
704 KB |
Output is correct |
11 |
Correct |
4 ms |
824 KB |
Output is correct |
12 |
Correct |
3 ms |
824 KB |
Output is correct |
13 |
Correct |
3 ms |
832 KB |
Output is correct |
14 |
Correct |
2 ms |
832 KB |
Output is correct |
15 |
Correct |
3 ms |
844 KB |
Output is correct |
16 |
Correct |
2 ms |
844 KB |
Output is correct |
17 |
Correct |
3 ms |
844 KB |
Output is correct |
18 |
Correct |
3 ms |
844 KB |
Output is correct |
19 |
Correct |
3 ms |
844 KB |
Output is correct |
20 |
Correct |
3 ms |
972 KB |
Output is correct |
21 |
Correct |
12 ms |
1124 KB |
Output is correct |
22 |
Correct |
12 ms |
1124 KB |
Output is correct |
23 |
Correct |
11 ms |
1124 KB |
Output is correct |
24 |
Correct |
12 ms |
1132 KB |
Output is correct |
25 |
Correct |
17 ms |
1300 KB |
Output is correct |
26 |
Correct |
12 ms |
1356 KB |
Output is correct |
27 |
Correct |
11 ms |
1484 KB |
Output is correct |
28 |
Correct |
12 ms |
1532 KB |
Output is correct |
29 |
Correct |
17 ms |
1612 KB |
Output is correct |
30 |
Correct |
15 ms |
1692 KB |
Output is correct |
31 |
Correct |
10 ms |
1692 KB |
Output is correct |
32 |
Correct |
14 ms |
1692 KB |
Output is correct |
33 |
Correct |
12 ms |
1692 KB |
Output is correct |
34 |
Correct |
11 ms |
1712 KB |
Output is correct |
35 |
Correct |
10 ms |
1724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
440 KB |
Output is correct |
3 |
Correct |
3 ms |
472 KB |
Output is correct |
4 |
Correct |
2 ms |
572 KB |
Output is correct |
5 |
Correct |
3 ms |
572 KB |
Output is correct |
6 |
Correct |
3 ms |
572 KB |
Output is correct |
7 |
Correct |
3 ms |
572 KB |
Output is correct |
8 |
Correct |
3 ms |
704 KB |
Output is correct |
9 |
Correct |
2 ms |
704 KB |
Output is correct |
10 |
Correct |
2 ms |
704 KB |
Output is correct |
11 |
Correct |
4 ms |
824 KB |
Output is correct |
12 |
Correct |
3 ms |
824 KB |
Output is correct |
13 |
Correct |
3 ms |
832 KB |
Output is correct |
14 |
Correct |
2 ms |
832 KB |
Output is correct |
15 |
Correct |
3 ms |
844 KB |
Output is correct |
16 |
Correct |
2 ms |
844 KB |
Output is correct |
17 |
Correct |
3 ms |
844 KB |
Output is correct |
18 |
Correct |
3 ms |
844 KB |
Output is correct |
19 |
Correct |
3 ms |
844 KB |
Output is correct |
20 |
Correct |
3 ms |
972 KB |
Output is correct |
21 |
Correct |
12 ms |
1124 KB |
Output is correct |
22 |
Correct |
12 ms |
1124 KB |
Output is correct |
23 |
Correct |
11 ms |
1124 KB |
Output is correct |
24 |
Correct |
12 ms |
1132 KB |
Output is correct |
25 |
Correct |
17 ms |
1300 KB |
Output is correct |
26 |
Correct |
12 ms |
1356 KB |
Output is correct |
27 |
Correct |
11 ms |
1484 KB |
Output is correct |
28 |
Correct |
12 ms |
1532 KB |
Output is correct |
29 |
Correct |
17 ms |
1612 KB |
Output is correct |
30 |
Correct |
15 ms |
1692 KB |
Output is correct |
31 |
Correct |
10 ms |
1692 KB |
Output is correct |
32 |
Correct |
14 ms |
1692 KB |
Output is correct |
33 |
Correct |
12 ms |
1692 KB |
Output is correct |
34 |
Correct |
11 ms |
1712 KB |
Output is correct |
35 |
Correct |
10 ms |
1724 KB |
Output is correct |
36 |
Correct |
168 ms |
4940 KB |
Output is correct |
37 |
Correct |
180 ms |
5896 KB |
Output is correct |
38 |
Correct |
178 ms |
6860 KB |
Output is correct |
39 |
Correct |
173 ms |
7912 KB |
Output is correct |
40 |
Correct |
189 ms |
8816 KB |
Output is correct |
41 |
Correct |
188 ms |
9632 KB |
Output is correct |
42 |
Correct |
186 ms |
10716 KB |
Output is correct |
43 |
Correct |
190 ms |
11560 KB |
Output is correct |
44 |
Correct |
205 ms |
12656 KB |
Output is correct |
45 |
Correct |
177 ms |
13540 KB |
Output is correct |
46 |
Correct |
150 ms |
13700 KB |
Output is correct |
47 |
Correct |
168 ms |
14024 KB |
Output is correct |
48 |
Correct |
141 ms |
14096 KB |
Output is correct |