# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151419 | 2019-09-02T19:47:15 Z | TadijaSebez | None (JOI14_ho_t3) | C++11 | 270 ms | 3804 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long const int N=200050; int a[N]; ll sum[N]; int main() { int n; scanf("%i",&n); for(int i=1;i<=n;i++) scanf("%i",&a[i]),a[i+n]=a[i]; for(int i=1;i<=2*n;i++) sum[i]=sum[i-1]+a[i]; ll all=sum[n],ans=0; function<ll(int,ll)> GetR=[&](int i, ll need) { int top=i+n-1,bot=i,mid,ans; while(top>=bot) { mid=top+bot>>1; if(sum[mid]-sum[i-1]>=need) ans=mid,top=mid-1; else bot=mid+1; } return sum[ans]-sum[i-1]; }; function<ll(int,ll)> GetL=[&](int i, ll need) { int top=i,bot=i-n+1,mid,ans; while(top>=bot) { mid=top+bot>>1; if(sum[i]-sum[mid-1]>=need) ans=mid,bot=mid+1; else top=mid-1; } return sum[i]-sum[ans-1]; }; for(int i=1,j=n;i<=n;i++) { ll top=all/3,bot=ans+1,mid; while(top>=bot) { mid=top+bot>>1; if(all-GetR(i,mid)-GetL(j,mid)>=mid) ans=mid,bot=mid+1; else top=mid-1; } j=i+n; } printf("%lld\n",ans); return 0; }
Compilation message
# | 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 | 376 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 | 3 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 | 376 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 | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 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 | 380 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 | 3 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 | 376 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 | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 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 | 380 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 | 3 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 6 ms | 504 KB | Output is correct |
22 | Correct | 6 ms | 504 KB | Output is correct |
23 | Correct | 6 ms | 632 KB | Output is correct |
24 | Correct | 5 ms | 504 KB | Output is correct |
25 | Correct | 6 ms | 504 KB | Output is correct |
26 | Correct | 13 ms | 632 KB | Output is correct |
27 | Correct | 13 ms | 632 KB | Output is correct |
28 | Correct | 12 ms | 764 KB | Output is correct |
29 | Correct | 13 ms | 632 KB | Output is correct |
30 | Correct | 13 ms | 632 KB | Output is correct |
31 | Correct | 19 ms | 504 KB | Output is correct |
32 | Correct | 19 ms | 504 KB | Output is correct |
33 | Correct | 19 ms | 504 KB | Output is correct |
34 | Correct | 19 ms | 508 KB | Output is correct |
35 | Correct | 19 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 | 376 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 | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 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 | 380 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 | 3 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 6 ms | 504 KB | Output is correct |
22 | Correct | 6 ms | 504 KB | Output is correct |
23 | Correct | 6 ms | 632 KB | Output is correct |
24 | Correct | 5 ms | 504 KB | Output is correct |
25 | Correct | 6 ms | 504 KB | Output is correct |
26 | Correct | 13 ms | 632 KB | Output is correct |
27 | Correct | 13 ms | 632 KB | Output is correct |
28 | Correct | 12 ms | 764 KB | Output is correct |
29 | Correct | 13 ms | 632 KB | Output is correct |
30 | Correct | 13 ms | 632 KB | Output is correct |
31 | Correct | 19 ms | 504 KB | Output is correct |
32 | Correct | 19 ms | 504 KB | Output is correct |
33 | Correct | 19 ms | 504 KB | Output is correct |
34 | Correct | 19 ms | 508 KB | Output is correct |
35 | Correct | 19 ms | 504 KB | Output is correct |
36 | Correct | 156 ms | 3804 KB | Output is correct |
37 | Correct | 136 ms | 3668 KB | Output is correct |
38 | Correct | 143 ms | 3776 KB | Output is correct |
39 | Correct | 153 ms | 3704 KB | Output is correct |
40 | Correct | 156 ms | 3716 KB | Output is correct |
41 | Correct | 144 ms | 3704 KB | Output is correct |
42 | Correct | 154 ms | 3576 KB | Output is correct |
43 | Correct | 152 ms | 3576 KB | Output is correct |
44 | Correct | 154 ms | 3692 KB | Output is correct |
45 | Correct | 154 ms | 3664 KB | Output is correct |
46 | Correct | 269 ms | 2908 KB | Output is correct |
47 | Correct | 268 ms | 2808 KB | Output is correct |
48 | Correct | 270 ms | 2808 KB | Output is correct |