Submission #873851

# Submission time Handle Problem Language Result Execution time Memory
873851 2023-11-16T01:20:55 Z 1075508020060209tc Hacker (BOI15_hac) C++14
100 / 100
185 ms 26276 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;
int ar[1000006];
int ps[1000006];
int pok[1000006];

int ok(int mi){
for(int i=1;i<=n+n;i++){
    pok[i]=0;
}
int len=(n+1)/2;
for(int i=len;i<=n+n;i++){
    pok[i]=0;
    if(ps[i]-ps[i-len]>=mi){
        pok[i]=1;
    }
}
for(int i=1;i<=n+n;i++){
    pok[i]+=pok[i-1];
}
for(int i=len;i<=n+n;i++){
    if(pok[i]-pok[i-len]==len){
        return 1;
    }
}
return 0;
}


signed main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ar[i];
        ar[i+n]=ar[i];
    }
    for(int i=1;i<=n+n;i++){
        ps[i]=ar[i]+ps[i-1];
    }
    int l=0;int r=1e9+10;
    while(l<r){
        int mi=l+(r-l+1)/2;
        if(ok(mi)){
            l=mi;
        }else{
            r=mi-1;
        }
    }
    cout<<l;

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2496 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2500 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2496 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2500 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2496 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 2 ms 2508 KB Output is correct
23 Correct 2 ms 2652 KB Output is correct
24 Correct 2 ms 2396 KB Output is correct
25 Correct 2 ms 2652 KB Output is correct
26 Correct 2 ms 2652 KB Output is correct
27 Correct 1 ms 2492 KB Output is correct
28 Correct 0 ms 2396 KB Output is correct
29 Correct 1 ms 2392 KB Output is correct
30 Correct 3 ms 2652 KB Output is correct
31 Correct 2 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 2 ms 2516 KB Output is correct
4 Correct 30 ms 9504 KB Output is correct
5 Correct 73 ms 16212 KB Output is correct
6 Correct 89 ms 16464 KB Output is correct
7 Correct 110 ms 20820 KB Output is correct
8 Correct 184 ms 25896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2496 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2500 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2496 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 2 ms 2508 KB Output is correct
23 Correct 2 ms 2652 KB Output is correct
24 Correct 2 ms 2396 KB Output is correct
25 Correct 2 ms 2652 KB Output is correct
26 Correct 2 ms 2652 KB Output is correct
27 Correct 1 ms 2492 KB Output is correct
28 Correct 0 ms 2396 KB Output is correct
29 Correct 1 ms 2392 KB Output is correct
30 Correct 3 ms 2652 KB Output is correct
31 Correct 2 ms 2652 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 2 ms 2516 KB Output is correct
35 Correct 30 ms 9504 KB Output is correct
36 Correct 73 ms 16212 KB Output is correct
37 Correct 89 ms 16464 KB Output is correct
38 Correct 110 ms 20820 KB Output is correct
39 Correct 184 ms 25896 KB Output is correct
40 Correct 4 ms 2656 KB Output is correct
41 Correct 8 ms 5128 KB Output is correct
42 Correct 12 ms 5348 KB Output is correct
43 Correct 72 ms 16212 KB Output is correct
44 Correct 184 ms 25936 KB Output is correct
45 Correct 34 ms 9564 KB Output is correct
46 Correct 112 ms 21076 KB Output is correct
47 Correct 185 ms 25940 KB Output is correct
48 Correct 183 ms 26276 KB Output is correct
49 Correct 177 ms 25424 KB Output is correct
50 Correct 170 ms 25424 KB Output is correct