# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
226371 | 2020-04-23T14:44:51 Z | MKopchev | Hacker (BOI15_hac) | C++14 | 260 ms | 8800 KB |
#include<bits/stdc++.h> using namespace std; const int nmax=5e5+42; int n,inp[nmax]; long long pref[nmax]; int take; long long ask(int l,int r) { while(l>n)l=l-n; while(r>n)r=r-n; if(l<=r)return pref[r]-pref[l-1]; return pref[r]+pref[n]-pref[l-1]; } bool can(long long want) { int now=0; for(int i=1;i<=2*n;i++) { if(ask(i,i+take-1)>=want)now++; else now=0; if(now>=take) { return 1; } } return 0; } int main() { scanf("%i",&n); for(int i=1;i<=n;i++)scanf("%i",&inp[i]); take=(n+1)/2; for(int i=1;i<=n;i++)pref[i]=pref[i-1]+inp[i]; long long ok=0,not_ok=1e18; while(not_ok-ok>1) { long long av=(ok+not_ok)/2; if(can(av))ok=av; else not_ok=av; } printf("%lld\n",ok); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 308 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 308 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 7 ms | 384 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 6 ms | 384 KB | Output is correct |
23 | Correct | 8 ms | 384 KB | Output is correct |
24 | Correct | 8 ms | 384 KB | Output is correct |
25 | Correct | 7 ms | 384 KB | Output is correct |
26 | Correct | 7 ms | 384 KB | Output is correct |
27 | Correct | 5 ms | 436 KB | Output is correct |
28 | Correct | 5 ms | 384 KB | Output is correct |
29 | Correct | 5 ms | 384 KB | Output is correct |
30 | Correct | 7 ms | 384 KB | Output is correct |
31 | Correct | 7 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 7 ms | 384 KB | Output is correct |
4 | Correct | 47 ms | 1784 KB | Output is correct |
5 | Correct | 107 ms | 3500 KB | Output is correct |
6 | Correct | 124 ms | 4344 KB | Output is correct |
7 | Correct | 141 ms | 5240 KB | Output is correct |
8 | Correct | 260 ms | 8312 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 308 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 7 ms | 384 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 6 ms | 384 KB | Output is correct |
23 | Correct | 8 ms | 384 KB | Output is correct |
24 | Correct | 8 ms | 384 KB | Output is correct |
25 | Correct | 7 ms | 384 KB | Output is correct |
26 | Correct | 7 ms | 384 KB | Output is correct |
27 | Correct | 5 ms | 436 KB | Output is correct |
28 | Correct | 5 ms | 384 KB | Output is correct |
29 | Correct | 5 ms | 384 KB | Output is correct |
30 | Correct | 7 ms | 384 KB | Output is correct |
31 | Correct | 7 ms | 384 KB | Output is correct |
32 | Correct | 5 ms | 384 KB | Output is correct |
33 | Correct | 5 ms | 384 KB | Output is correct |
34 | Correct | 7 ms | 384 KB | Output is correct |
35 | Correct | 47 ms | 1784 KB | Output is correct |
36 | Correct | 107 ms | 3500 KB | Output is correct |
37 | Correct | 124 ms | 4344 KB | Output is correct |
38 | Correct | 141 ms | 5240 KB | Output is correct |
39 | Correct | 260 ms | 8312 KB | Output is correct |
40 | Correct | 10 ms | 512 KB | Output is correct |
41 | Correct | 13 ms | 640 KB | Output is correct |
42 | Correct | 20 ms | 896 KB | Output is correct |
43 | Correct | 96 ms | 3584 KB | Output is correct |
44 | Correct | 248 ms | 8440 KB | Output is correct |
45 | Correct | 49 ms | 1912 KB | Output is correct |
46 | Correct | 154 ms | 5212 KB | Output is correct |
47 | Correct | 249 ms | 8312 KB | Output is correct |
48 | Correct | 234 ms | 8800 KB | Output is correct |
49 | Correct | 222 ms | 7800 KB | Output is correct |
50 | Correct | 229 ms | 7800 KB | Output is correct |