# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
55140 | 2018-07-06T06:18:04 Z | 김세빈(#1527) | None (JOI14_ho_t3) | C++11 | 3 ms | 540 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll A[202020]; ll n, sum; bool check(ll k) { ll i, j, l, s1, s2; s1 = s2 = 0; for(i=j=l=1;i<=n;i++){ for(;j<=n+i && s1<k;j++) s1 += A[j], s2 -= A[j]; for(;l<=n+i && s2<s1;l++) s2 += A[l]; if(s2 >= s1 && sum - s2 - s1 >= s1) return 1; s1 -= A[i]; } return 0; } int main() { ll i, s, e, mid; scanf("%lld", &n); for(i=1;i<=n;i++){ scanf("%lld", A+i); sum += A[i]; A[n+i] = A[i]; } for(s=0,e=1e18;s<=e;){ mid = s+e>>1; if(check(mid)) s = mid+1; else e = mid-1; } check(1); printf("%lld\n", s-1); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 540 KB | Output is correct |
4 | Incorrect | 2 ms | 540 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 540 KB | Output is correct |
4 | Incorrect | 2 ms | 540 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 540 KB | Output is correct |
4 | Incorrect | 2 ms | 540 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 540 KB | Output is correct |
4 | Incorrect | 2 ms | 540 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |