Submission #129980

# Submission time Handle Problem Language Result Execution time Memory
129980 2019-07-13T17:11:22 Z Vardanyan Hacker (BOI15_hac) C++14
20 / 100
1000 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 500*1000+5;
int a[N];

int main(){
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    long long all = 0;
    for(int i = 1;i<=n;i++) {
        cin>>a[i];
        all+=a[i];
    }
    long long ans = 0;
    for(int i = 1;i<=n;i++){
        long long mx = 0;
        for(int j = 1;j<=n;j++){
            int jj = j;
            int qn = 0;
            long long cur = 0;
            while(1){
                if(jj == i) break;
                cur+=a[jj];
                qn++;
                if(qn == n/2) break;
                jj++;
                if(jj>n) jj = 1;
            }
            mx = max(mx,cur);
        }
        ans = max(ans,all-mx);
    }
    cout<<ans<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 19 ms 380 KB Output is correct
8 Correct 18 ms 376 KB Output is correct
9 Correct 18 ms 376 KB Output is correct
10 Correct 19 ms 504 KB Output is correct
11 Correct 18 ms 376 KB Output is correct
12 Correct 18 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 18 ms 376 KB Output is correct
17 Correct 18 ms 376 KB Output is correct
18 Correct 18 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 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 19 ms 380 KB Output is correct
8 Correct 18 ms 376 KB Output is correct
9 Correct 18 ms 376 KB Output is correct
10 Correct 19 ms 504 KB Output is correct
11 Correct 18 ms 376 KB Output is correct
12 Correct 18 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 18 ms 376 KB Output is correct
17 Correct 18 ms 376 KB Output is correct
18 Correct 18 ms 376 KB Output is correct
19 Correct 77 ms 376 KB Output is correct
20 Correct 598 ms 428 KB Output is correct
21 Correct 253 ms 416 KB Output is correct
22 Execution timed out 1068 ms 376 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 41 ms 376 KB Output is correct
3 Execution timed out 1065 ms 376 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 19 ms 380 KB Output is correct
8 Correct 18 ms 376 KB Output is correct
9 Correct 18 ms 376 KB Output is correct
10 Correct 19 ms 504 KB Output is correct
11 Correct 18 ms 376 KB Output is correct
12 Correct 18 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 18 ms 376 KB Output is correct
17 Correct 18 ms 376 KB Output is correct
18 Correct 18 ms 376 KB Output is correct
19 Correct 77 ms 376 KB Output is correct
20 Correct 598 ms 428 KB Output is correct
21 Correct 253 ms 416 KB Output is correct
22 Execution timed out 1068 ms 376 KB Time limit exceeded
23 Halted 0 ms 0 KB -