# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
153828 | 2019-09-16T15:33:52 Z | songc | 도넛 (JOI14_ho_t3) | C++14 | 399 ms | 2936 KB |
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int,int> pii; int N; LL ans, S[101010], RS[101010]; bool chk(LL k){ for (int i=1; i<N; i++){ int l = N+1-(lower_bound(RS+N-i+1, RS+N+1, k+RS[N-i])-RS); int r = lower_bound(S+i+1, S+N+1, k+S[i])-S; if (l < 1 || N < r) continue; if (S[l-1] + S[N] - S[r] >= k) return true; } return false; } int main(){ scanf("%d", &N); for (int i=1; i<=N; i++){ scanf("%lld", &S[i]); RS[N-i+1] = S[i]; } for (int i=1; i<=N; i++) S[i] += S[i-1], RS[i] += RS[i-1]; LL L=0, R=(1ll<<60); while (L<=R){ LL mid = (L+R)/2; if (chk(mid)) ans=mid, L=mid+1; else R = mid-1; } printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 504 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 | 256 KB | Output is correct |
6 | Correct | 2 ms | 400 KB | Output is correct |
7 | Correct | 2 ms | 360 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 252 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 504 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 | 256 KB | Output is correct |
6 | Correct | 2 ms | 400 KB | Output is correct |
7 | Correct | 2 ms | 360 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 252 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 256 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 3 ms | 256 KB | Output is correct |
17 | Correct | 3 ms | 256 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 504 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 | 256 KB | Output is correct |
6 | Correct | 2 ms | 400 KB | Output is correct |
7 | Correct | 2 ms | 360 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 252 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 256 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 3 ms | 256 KB | Output is correct |
17 | Correct | 3 ms | 256 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 27 ms | 504 KB | Output is correct |
22 | Correct | 27 ms | 504 KB | Output is correct |
23 | Correct | 25 ms | 504 KB | Output is correct |
24 | Correct | 24 ms | 504 KB | Output is correct |
25 | Correct | 27 ms | 504 KB | Output is correct |
26 | Correct | 29 ms | 636 KB | Output is correct |
27 | Correct | 30 ms | 504 KB | Output is correct |
28 | Correct | 30 ms | 504 KB | Output is correct |
29 | Correct | 32 ms | 504 KB | Output is correct |
30 | Correct | 29 ms | 504 KB | Output is correct |
31 | Correct | 25 ms | 536 KB | Output is correct |
32 | Correct | 25 ms | 504 KB | Output is correct |
33 | Correct | 26 ms | 504 KB | Output is correct |
34 | Correct | 25 ms | 504 KB | Output is correct |
35 | Correct | 24 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 504 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 | 256 KB | Output is correct |
6 | Correct | 2 ms | 400 KB | Output is correct |
7 | Correct | 2 ms | 360 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 252 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 256 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 3 ms | 256 KB | Output is correct |
17 | Correct | 3 ms | 256 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 27 ms | 504 KB | Output is correct |
22 | Correct | 27 ms | 504 KB | Output is correct |
23 | Correct | 25 ms | 504 KB | Output is correct |
24 | Correct | 24 ms | 504 KB | Output is correct |
25 | Correct | 27 ms | 504 KB | Output is correct |
26 | Correct | 29 ms | 636 KB | Output is correct |
27 | Correct | 30 ms | 504 KB | Output is correct |
28 | Correct | 30 ms | 504 KB | Output is correct |
29 | Correct | 32 ms | 504 KB | Output is correct |
30 | Correct | 29 ms | 504 KB | Output is correct |
31 | Correct | 25 ms | 536 KB | Output is correct |
32 | Correct | 25 ms | 504 KB | Output is correct |
33 | Correct | 26 ms | 504 KB | Output is correct |
34 | Correct | 25 ms | 504 KB | Output is correct |
35 | Correct | 24 ms | 504 KB | Output is correct |
36 | Correct | 391 ms | 2900 KB | Output is correct |
37 | Correct | 392 ms | 2900 KB | Output is correct |
38 | Correct | 394 ms | 2808 KB | Output is correct |
39 | Correct | 384 ms | 2936 KB | Output is correct |
40 | Correct | 336 ms | 2888 KB | Output is correct |
41 | Correct | 388 ms | 2936 KB | Output is correct |
42 | Correct | 361 ms | 2892 KB | Output is correct |
43 | Correct | 378 ms | 2812 KB | Output is correct |
44 | Correct | 399 ms | 2936 KB | Output is correct |
45 | Correct | 346 ms | 2812 KB | Output is correct |
46 | Correct | 362 ms | 2224 KB | Output is correct |
47 | Correct | 378 ms | 2168 KB | Output is correct |
48 | Correct | 368 ms | 2168 KB | Output is correct |