Submission #723564

# Submission time Handle Problem Language Result Execution time Memory
723564 2023-04-14T05:14:15 Z Erkinoff_Mohammed Hacker (BOI15_hac) C++14
60 / 100
191 ms 4180 KB
#include "bits/stdc++.h"
using namespace std;
#define INF 2000000000
#define INFLL 3000000000000000000LL
#define ll long long





int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n;
    cin>>n;
    ll arr[n];
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        sum+=arr[i];
    }
    ll mx=0;
    if(n<=5000){
        for(int i=0;i<n;i++){
            ll sum2=0;
            ll mn=INF;
            for(int j=i+1;j<i+n/2+1;j++){
                sum2+=arr[j%n];
            }
            for(int j=i+1;j<i+n/2+1+(n%2);j++){
                //cout<<sum2<<"\n";
                mn=min(mn,sum-sum2);
                sum2-=arr[(j)%n];
                sum2+=arr[(j+n/2)%n];
            }
            //cout<<"\n";
            mx=max(mx,mn);
        }
    }
    else{
        for(int i=0;i<1;i++){
            ll sum2=0;
            ll mn=INF;
            for(int j=i+1;j<i+n/2+1;j++){
                sum2+=arr[j%n];
            }
            for(int j=i+1;j<i+n/2+1+(n%2);j++){
                //cout<<sum2<<"\n";
                mn=min(mn,sum-sum2);
                sum2-=arr[(j)%n];
                sum2+=arr[(j+n/2)%n];
            }
            //cout<<"\n";
            mx=max(mx,mn);
        }
    }
    cout<<mx;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 7 ms 324 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 62 ms 320 KB Output is correct
23 Correct 181 ms 340 KB Output is correct
24 Correct 64 ms 332 KB Output is correct
25 Correct 186 ms 340 KB Output is correct
26 Correct 179 ms 340 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 181 ms 340 KB Output is correct
31 Correct 187 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 224 KB Output is correct
3 Correct 191 ms 340 KB Output is correct
4 Correct 7 ms 852 KB Output is correct
5 Correct 13 ms 1884 KB Output is correct
6 Correct 19 ms 2268 KB Output is correct
7 Correct 24 ms 2648 KB Output is correct
8 Correct 40 ms 4180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 7 ms 324 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 62 ms 320 KB Output is correct
23 Correct 181 ms 340 KB Output is correct
24 Correct 64 ms 332 KB Output is correct
25 Correct 186 ms 340 KB Output is correct
26 Correct 179 ms 340 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 181 ms 340 KB Output is correct
31 Correct 187 ms 340 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 2 ms 224 KB Output is correct
34 Correct 191 ms 340 KB Output is correct
35 Correct 7 ms 852 KB Output is correct
36 Correct 13 ms 1884 KB Output is correct
37 Correct 19 ms 2268 KB Output is correct
38 Correct 24 ms 2648 KB Output is correct
39 Correct 40 ms 4180 KB Output is correct
40 Incorrect 1 ms 340 KB Output isn't correct
41 Halted 0 ms 0 KB -