# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
55133 |
2018-07-06T05:57:54 Z |
윤교준(#1528) |
None (JOI14_ho_t3) |
C++11 |
|
50 ms |
14488 KB |
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[sz(V)-2])
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define upmax(a,b) (a)=max((a),(b))
#define upmin(a,b) (a)=min((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
const int MAXN = 100005;
ll S[MAXN*3];
int A[MAXN];
ll Ans;
int N;
int main() {
//freopen("input.txt", "r", stdin);
ios::sync_with_stdio(false);
cin >> N;
for(int i = 1; i <= N; i++) cin >> A[i];
for(int i = 1; i <= N; i++) S[i] = S[i-1] + A[i];
for(int i = N+1; i <= 2*N; i++) S[i] = S[i-1] + A[i-N];
for(int i = 2*N+1; i <= 3*N; i++) S[i] = S[i-1] + A[i-2*N];
for(int i = 1, j = 1; i <= N; i++) {
for(j = max(i, j); j < i+N; j++) {
ll sum = S[j] - S[i-1];
if(S[N] < sum*3) break;
int s = j+1, e = i+N-1; for(int m; s < e;) {
m = (s+e)/2;
ll t = S[m] - S[j];
if(t < sum) s = m+1;
else e = m;
}
if(S[s] - S[j] < sum) break;
if(S[i+N-1] - S[s] < sum) break;
}
upmax(Ans, S[j-1] - S[i-1]);
}
cout << Ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
548 KB |
Output is correct |
4 |
Correct |
3 ms |
548 KB |
Output is correct |
5 |
Correct |
2 ms |
548 KB |
Output is correct |
6 |
Correct |
2 ms |
548 KB |
Output is correct |
7 |
Correct |
2 ms |
556 KB |
Output is correct |
8 |
Correct |
3 ms |
728 KB |
Output is correct |
9 |
Correct |
3 ms |
728 KB |
Output is correct |
10 |
Correct |
3 ms |
728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
548 KB |
Output is correct |
4 |
Correct |
3 ms |
548 KB |
Output is correct |
5 |
Correct |
2 ms |
548 KB |
Output is correct |
6 |
Correct |
2 ms |
548 KB |
Output is correct |
7 |
Correct |
2 ms |
556 KB |
Output is correct |
8 |
Correct |
3 ms |
728 KB |
Output is correct |
9 |
Correct |
3 ms |
728 KB |
Output is correct |
10 |
Correct |
3 ms |
728 KB |
Output is correct |
11 |
Correct |
3 ms |
728 KB |
Output is correct |
12 |
Correct |
2 ms |
728 KB |
Output is correct |
13 |
Correct |
3 ms |
728 KB |
Output is correct |
14 |
Correct |
3 ms |
728 KB |
Output is correct |
15 |
Correct |
3 ms |
728 KB |
Output is correct |
16 |
Correct |
3 ms |
728 KB |
Output is correct |
17 |
Correct |
2 ms |
728 KB |
Output is correct |
18 |
Correct |
2 ms |
728 KB |
Output is correct |
19 |
Correct |
2 ms |
732 KB |
Output is correct |
20 |
Correct |
3 ms |
736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
548 KB |
Output is correct |
4 |
Correct |
3 ms |
548 KB |
Output is correct |
5 |
Correct |
2 ms |
548 KB |
Output is correct |
6 |
Correct |
2 ms |
548 KB |
Output is correct |
7 |
Correct |
2 ms |
556 KB |
Output is correct |
8 |
Correct |
3 ms |
728 KB |
Output is correct |
9 |
Correct |
3 ms |
728 KB |
Output is correct |
10 |
Correct |
3 ms |
728 KB |
Output is correct |
11 |
Correct |
3 ms |
728 KB |
Output is correct |
12 |
Correct |
2 ms |
728 KB |
Output is correct |
13 |
Correct |
3 ms |
728 KB |
Output is correct |
14 |
Correct |
3 ms |
728 KB |
Output is correct |
15 |
Correct |
3 ms |
728 KB |
Output is correct |
16 |
Correct |
3 ms |
728 KB |
Output is correct |
17 |
Correct |
2 ms |
728 KB |
Output is correct |
18 |
Correct |
2 ms |
728 KB |
Output is correct |
19 |
Correct |
2 ms |
732 KB |
Output is correct |
20 |
Correct |
3 ms |
736 KB |
Output is correct |
21 |
Correct |
4 ms |
996 KB |
Output is correct |
22 |
Correct |
4 ms |
1040 KB |
Output is correct |
23 |
Correct |
6 ms |
1220 KB |
Output is correct |
24 |
Correct |
5 ms |
1220 KB |
Output is correct |
25 |
Correct |
4 ms |
1220 KB |
Output is correct |
26 |
Correct |
6 ms |
1248 KB |
Output is correct |
27 |
Correct |
6 ms |
1344 KB |
Output is correct |
28 |
Correct |
5 ms |
1480 KB |
Output is correct |
29 |
Correct |
4 ms |
1560 KB |
Output is correct |
30 |
Correct |
5 ms |
1676 KB |
Output is correct |
31 |
Correct |
5 ms |
1808 KB |
Output is correct |
32 |
Correct |
5 ms |
1808 KB |
Output is correct |
33 |
Correct |
5 ms |
1808 KB |
Output is correct |
34 |
Correct |
6 ms |
1808 KB |
Output is correct |
35 |
Correct |
4 ms |
1808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
548 KB |
Output is correct |
4 |
Correct |
3 ms |
548 KB |
Output is correct |
5 |
Correct |
2 ms |
548 KB |
Output is correct |
6 |
Correct |
2 ms |
548 KB |
Output is correct |
7 |
Correct |
2 ms |
556 KB |
Output is correct |
8 |
Correct |
3 ms |
728 KB |
Output is correct |
9 |
Correct |
3 ms |
728 KB |
Output is correct |
10 |
Correct |
3 ms |
728 KB |
Output is correct |
11 |
Correct |
3 ms |
728 KB |
Output is correct |
12 |
Correct |
2 ms |
728 KB |
Output is correct |
13 |
Correct |
3 ms |
728 KB |
Output is correct |
14 |
Correct |
3 ms |
728 KB |
Output is correct |
15 |
Correct |
3 ms |
728 KB |
Output is correct |
16 |
Correct |
3 ms |
728 KB |
Output is correct |
17 |
Correct |
2 ms |
728 KB |
Output is correct |
18 |
Correct |
2 ms |
728 KB |
Output is correct |
19 |
Correct |
2 ms |
732 KB |
Output is correct |
20 |
Correct |
3 ms |
736 KB |
Output is correct |
21 |
Correct |
4 ms |
996 KB |
Output is correct |
22 |
Correct |
4 ms |
1040 KB |
Output is correct |
23 |
Correct |
6 ms |
1220 KB |
Output is correct |
24 |
Correct |
5 ms |
1220 KB |
Output is correct |
25 |
Correct |
4 ms |
1220 KB |
Output is correct |
26 |
Correct |
6 ms |
1248 KB |
Output is correct |
27 |
Correct |
6 ms |
1344 KB |
Output is correct |
28 |
Correct |
5 ms |
1480 KB |
Output is correct |
29 |
Correct |
4 ms |
1560 KB |
Output is correct |
30 |
Correct |
5 ms |
1676 KB |
Output is correct |
31 |
Correct |
5 ms |
1808 KB |
Output is correct |
32 |
Correct |
5 ms |
1808 KB |
Output is correct |
33 |
Correct |
5 ms |
1808 KB |
Output is correct |
34 |
Correct |
6 ms |
1808 KB |
Output is correct |
35 |
Correct |
4 ms |
1808 KB |
Output is correct |
36 |
Correct |
36 ms |
5272 KB |
Output is correct |
37 |
Correct |
48 ms |
6108 KB |
Output is correct |
38 |
Correct |
38 ms |
7200 KB |
Output is correct |
39 |
Correct |
49 ms |
8164 KB |
Output is correct |
40 |
Correct |
37 ms |
9016 KB |
Output is correct |
41 |
Correct |
50 ms |
9964 KB |
Output is correct |
42 |
Correct |
30 ms |
10928 KB |
Output is correct |
43 |
Correct |
39 ms |
12020 KB |
Output is correct |
44 |
Correct |
35 ms |
12984 KB |
Output is correct |
45 |
Correct |
35 ms |
13824 KB |
Output is correct |
46 |
Correct |
29 ms |
14148 KB |
Output is correct |
47 |
Correct |
30 ms |
14300 KB |
Output is correct |
48 |
Correct |
29 ms |
14488 KB |
Output is correct |