답안 #55146

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
55146 2018-07-06T06:25:35 Z 노영훈(#1526) 도넛 (JOI14_ho_t3) C++11
100 / 100
209 ms 3068 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 444 KB Output is correct
3 Correct 2 ms 556 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 444 KB Output is correct
3 Correct 2 ms 556 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 3 ms 596 KB Output is correct
12 Correct 3 ms 620 KB Output is correct
13 Correct 3 ms 620 KB Output is correct
14 Correct 3 ms 620 KB Output is correct
15 Correct 3 ms 620 KB Output is correct
16 Correct 3 ms 620 KB Output is correct
17 Correct 3 ms 620 KB Output is correct
18 Correct 4 ms 620 KB Output is correct
19 Correct 2 ms 620 KB Output is correct
20 Correct 4 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 444 KB Output is correct
3 Correct 2 ms 556 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 3 ms 596 KB Output is correct
12 Correct 3 ms 620 KB Output is correct
13 Correct 3 ms 620 KB Output is correct
14 Correct 3 ms 620 KB Output is correct
15 Correct 3 ms 620 KB Output is correct
16 Correct 3 ms 620 KB Output is correct
17 Correct 3 ms 620 KB Output is correct
18 Correct 4 ms 620 KB Output is correct
19 Correct 2 ms 620 KB Output is correct
20 Correct 4 ms 620 KB Output is correct
21 Correct 11 ms 748 KB Output is correct
22 Correct 11 ms 748 KB Output is correct
23 Correct 11 ms 748 KB Output is correct
24 Correct 11 ms 748 KB Output is correct
25 Correct 13 ms 748 KB Output is correct
26 Correct 11 ms 748 KB Output is correct
27 Correct 10 ms 748 KB Output is correct
28 Correct 10 ms 792 KB Output is correct
29 Correct 11 ms 792 KB Output is correct
30 Correct 11 ms 792 KB Output is correct
31 Correct 9 ms 792 KB Output is correct
32 Correct 11 ms 792 KB Output is correct
33 Correct 12 ms 808 KB Output is correct
34 Correct 10 ms 844 KB Output is correct
35 Correct 11 ms 844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 444 KB Output is correct
3 Correct 2 ms 556 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 3 ms 596 KB Output is correct
12 Correct 3 ms 620 KB Output is correct
13 Correct 3 ms 620 KB Output is correct
14 Correct 3 ms 620 KB Output is correct
15 Correct 3 ms 620 KB Output is correct
16 Correct 3 ms 620 KB Output is correct
17 Correct 3 ms 620 KB Output is correct
18 Correct 4 ms 620 KB Output is correct
19 Correct 2 ms 620 KB Output is correct
20 Correct 4 ms 620 KB Output is correct
21 Correct 11 ms 748 KB Output is correct
22 Correct 11 ms 748 KB Output is correct
23 Correct 11 ms 748 KB Output is correct
24 Correct 11 ms 748 KB Output is correct
25 Correct 13 ms 748 KB Output is correct
26 Correct 11 ms 748 KB Output is correct
27 Correct 10 ms 748 KB Output is correct
28 Correct 10 ms 792 KB Output is correct
29 Correct 11 ms 792 KB Output is correct
30 Correct 11 ms 792 KB Output is correct
31 Correct 9 ms 792 KB Output is correct
32 Correct 11 ms 792 KB Output is correct
33 Correct 12 ms 808 KB Output is correct
34 Correct 10 ms 844 KB Output is correct
35 Correct 11 ms 844 KB Output is correct
36 Correct 179 ms 2996 KB Output is correct
37 Correct 187 ms 2996 KB Output is correct
38 Correct 193 ms 2996 KB Output is correct
39 Correct 164 ms 2996 KB Output is correct
40 Correct 205 ms 2996 KB Output is correct
41 Correct 188 ms 2996 KB Output is correct
42 Correct 164 ms 2996 KB Output is correct
43 Correct 198 ms 3068 KB Output is correct
44 Correct 209 ms 3068 KB Output is correct
45 Correct 165 ms 3068 KB Output is correct
46 Correct 147 ms 3068 KB Output is correct
47 Correct 169 ms 3068 KB Output is correct
48 Correct 183 ms 3068 KB Output is correct