# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
55145 | 2018-07-06T06:25:28 Z | 김세빈(#1527) | 도넛 (JOI14_ho_t3) | C++11 | 133 ms | 2304 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<k;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; } printf("%lld\n", s-1); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 464 KB | Output is correct |
4 | Correct | 2 ms | 464 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 616 KB | Output is correct |
7 | Correct | 2 ms | 616 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 2 ms | 616 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 464 KB | Output is correct |
4 | Correct | 2 ms | 464 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 616 KB | Output is correct |
7 | Correct | 2 ms | 616 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 2 ms | 616 KB | Output is correct |
11 | Correct | 3 ms | 616 KB | Output is correct |
12 | Correct | 2 ms | 616 KB | Output is correct |
13 | Correct | 2 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 636 KB | Output is correct |
15 | Correct | 3 ms | 636 KB | Output is correct |
16 | Correct | 2 ms | 636 KB | Output is correct |
17 | Correct | 3 ms | 636 KB | Output is correct |
18 | Correct | 3 ms | 636 KB | Output is correct |
19 | Correct | 3 ms | 636 KB | Output is correct |
20 | Correct | 3 ms | 636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 464 KB | Output is correct |
4 | Correct | 2 ms | 464 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 616 KB | Output is correct |
7 | Correct | 2 ms | 616 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 2 ms | 616 KB | Output is correct |
11 | Correct | 3 ms | 616 KB | Output is correct |
12 | Correct | 2 ms | 616 KB | Output is correct |
13 | Correct | 2 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 636 KB | Output is correct |
15 | Correct | 3 ms | 636 KB | Output is correct |
16 | Correct | 2 ms | 636 KB | Output is correct |
17 | Correct | 3 ms | 636 KB | Output is correct |
18 | Correct | 3 ms | 636 KB | Output is correct |
19 | Correct | 3 ms | 636 KB | Output is correct |
20 | Correct | 3 ms | 636 KB | Output is correct |
21 | Correct | 9 ms | 636 KB | Output is correct |
22 | Correct | 8 ms | 636 KB | Output is correct |
23 | Correct | 9 ms | 636 KB | Output is correct |
24 | Correct | 8 ms | 636 KB | Output is correct |
25 | Correct | 9 ms | 644 KB | Output is correct |
26 | Correct | 7 ms | 644 KB | Output is correct |
27 | Correct | 9 ms | 644 KB | Output is correct |
28 | Correct | 11 ms | 644 KB | Output is correct |
29 | Correct | 8 ms | 644 KB | Output is correct |
30 | Correct | 9 ms | 644 KB | Output is correct |
31 | Correct | 6 ms | 644 KB | Output is correct |
32 | Correct | 9 ms | 644 KB | Output is correct |
33 | Correct | 7 ms | 644 KB | Output is correct |
34 | Correct | 7 ms | 764 KB | Output is correct |
35 | Correct | 7 ms | 764 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 464 KB | Output is correct |
4 | Correct | 2 ms | 464 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 616 KB | Output is correct |
7 | Correct | 2 ms | 616 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 2 ms | 616 KB | Output is correct |
11 | Correct | 3 ms | 616 KB | Output is correct |
12 | Correct | 2 ms | 616 KB | Output is correct |
13 | Correct | 2 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 636 KB | Output is correct |
15 | Correct | 3 ms | 636 KB | Output is correct |
16 | Correct | 2 ms | 636 KB | Output is correct |
17 | Correct | 3 ms | 636 KB | Output is correct |
18 | Correct | 3 ms | 636 KB | Output is correct |
19 | Correct | 3 ms | 636 KB | Output is correct |
20 | Correct | 3 ms | 636 KB | Output is correct |
21 | Correct | 9 ms | 636 KB | Output is correct |
22 | Correct | 8 ms | 636 KB | Output is correct |
23 | Correct | 9 ms | 636 KB | Output is correct |
24 | Correct | 8 ms | 636 KB | Output is correct |
25 | Correct | 9 ms | 644 KB | Output is correct |
26 | Correct | 7 ms | 644 KB | Output is correct |
27 | Correct | 9 ms | 644 KB | Output is correct |
28 | Correct | 11 ms | 644 KB | Output is correct |
29 | Correct | 8 ms | 644 KB | Output is correct |
30 | Correct | 9 ms | 644 KB | Output is correct |
31 | Correct | 6 ms | 644 KB | Output is correct |
32 | Correct | 9 ms | 644 KB | Output is correct |
33 | Correct | 7 ms | 644 KB | Output is correct |
34 | Correct | 7 ms | 764 KB | Output is correct |
35 | Correct | 7 ms | 764 KB | Output is correct |
36 | Correct | 104 ms | 2172 KB | Output is correct |
37 | Correct | 111 ms | 2172 KB | Output is correct |
38 | Correct | 91 ms | 2172 KB | Output is correct |
39 | Correct | 111 ms | 2176 KB | Output is correct |
40 | Correct | 102 ms | 2208 KB | Output is correct |
41 | Correct | 113 ms | 2300 KB | Output is correct |
42 | Correct | 126 ms | 2304 KB | Output is correct |
43 | Correct | 101 ms | 2304 KB | Output is correct |
44 | Correct | 100 ms | 2304 KB | Output is correct |
45 | Correct | 133 ms | 2304 KB | Output is correct |
46 | Correct | 39 ms | 2304 KB | Output is correct |
47 | Correct | 41 ms | 2304 KB | Output is correct |
48 | Correct | 39 ms | 2304 KB | Output is correct |