Submission #95548

# Submission time Handle Problem Language Result Execution time Memory
95548 2019-02-02T03:31:04 Z easrui None (JOI14_ho_t3) C++14
100 / 100
505 ms 3320 KB
#include <bits/stdc++.h>
using namespace std;
const int MN = 1e5+5;
int N,A[MN],sa,sb,sc,pos;
long long S[2*MN],tmp,sz,res,ans;
int main()
{
    //freopen("input.txt","r",stdin);
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> N;
    for(int i=1; i<=N; i++) cin >> A[i];
    for(int i=1; i<=2*N; i++) S[i] = S[i-1] + A[(i-1)%N+1];
    while(sa<N){
        while(sz <= min(S[sc+1]-S[sb],S[sa+N]-S[sc+1])){
            sz = min(S[sc+1]-S[sb],S[sa+N]-S[sc+1]);
            sc++;
        }
        res = min(S[sb]-S[sa],sz);
        while(1){
            pos = sc;
            tmp = min(S[sc]-S[sb+1],S[sa+N]-S[sc]);
            while(tmp <= min(S[pos+1]-S[sb+1],S[sa+N]-S[pos+1])){
                tmp = min(S[pos+1]-S[sb+1],S[sa+N]-S[pos+1]);
                pos++;
            }
            if(res<=min(S[sb+1]-S[sa],tmp)){
                res = min(S[sb+1]-S[sa],tmp);
                sz = tmp;
                sc = pos;
                sb++;
            } else break;
        }
        ans = max(ans,res);
        sa++;
    }
    cout << ans;
}
# 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 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 408 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 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 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 408 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 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 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 408 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 3 ms 504 KB Output is correct
22 Correct 3 ms 504 KB Output is correct
23 Correct 3 ms 632 KB Output is correct
24 Correct 3 ms 504 KB Output is correct
25 Correct 3 ms 504 KB Output is correct
26 Correct 3 ms 504 KB Output is correct
27 Correct 3 ms 632 KB Output is correct
28 Correct 4 ms 632 KB Output is correct
29 Correct 3 ms 632 KB Output is correct
30 Correct 3 ms 632 KB Output is correct
31 Correct 5 ms 504 KB Output is correct
32 Correct 6 ms 504 KB Output is correct
33 Correct 5 ms 504 KB Output is correct
34 Correct 6 ms 504 KB Output is correct
35 Correct 6 ms 504 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 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 408 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 3 ms 504 KB Output is correct
22 Correct 3 ms 504 KB Output is correct
23 Correct 3 ms 632 KB Output is correct
24 Correct 3 ms 504 KB Output is correct
25 Correct 3 ms 504 KB Output is correct
26 Correct 3 ms 504 KB Output is correct
27 Correct 3 ms 632 KB Output is correct
28 Correct 4 ms 632 KB Output is correct
29 Correct 3 ms 632 KB Output is correct
30 Correct 3 ms 632 KB Output is correct
31 Correct 5 ms 504 KB Output is correct
32 Correct 6 ms 504 KB Output is correct
33 Correct 5 ms 504 KB Output is correct
34 Correct 6 ms 504 KB Output is correct
35 Correct 6 ms 504 KB Output is correct
36 Correct 19 ms 3320 KB Output is correct
37 Correct 19 ms 3192 KB Output is correct
38 Correct 19 ms 3320 KB Output is correct
39 Correct 26 ms 3292 KB Output is correct
40 Correct 18 ms 3320 KB Output is correct
41 Correct 19 ms 3292 KB Output is correct
42 Correct 18 ms 3320 KB Output is correct
43 Correct 19 ms 3192 KB Output is correct
44 Correct 19 ms 3192 KB Output is correct
45 Correct 20 ms 3320 KB Output is correct
46 Correct 493 ms 2564 KB Output is correct
47 Correct 501 ms 2568 KB Output is correct
48 Correct 505 ms 2552 KB Output is correct