# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
199425 | 2020-02-01T11:41:58 Z | semiauto | Bigger segments (IZhO19_segments) | C++14 | 145 ms | 18936 KB |
#include <bits/stdc++.h> using namespace std; long long sum[500002]; int dp[500002]; pair <long long,int> hey[500002]; int main() { int n; scanf("%d",&n); int s=1; for (int i=1;i<=n;i++) { int x; scanf("%d",&x); sum[i]=sum[i-1]+x; int pos=1; for (int j=18;j>=0;j--) if (pos+(1<<j)<=s && hey[pos+(1<<j)].first<=sum[i]) pos+=(1<<j); dp[i]=dp[hey[pos].second]+1; for (;s>=0;s--) if (hey[s].first<2*sum[i]-sum[hey[pos].second]) break; hey[++s]={2*sum[i]-sum[hey[pos].second],i}; } printf("%d\n",dp[n]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 248 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 380 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 380 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 248 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 380 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 380 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 376 KB | Output is correct |
16 | Correct | 5 ms | 376 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 380 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 6 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 5 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 376 KB | Output is correct |
26 | Correct | 5 ms | 376 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 5 ms | 376 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 248 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 380 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 380 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 376 KB | Output is correct |
16 | Correct | 5 ms | 376 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 380 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 6 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 5 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 376 KB | Output is correct |
26 | Correct | 5 ms | 376 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 5 ms | 376 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 5 ms | 376 KB | Output is correct |
33 | Correct | 6 ms | 376 KB | Output is correct |
34 | Correct | 6 ms | 376 KB | Output is correct |
35 | Correct | 6 ms | 376 KB | Output is correct |
36 | Correct | 6 ms | 376 KB | Output is correct |
37 | Correct | 5 ms | 376 KB | Output is correct |
38 | Correct | 6 ms | 376 KB | Output is correct |
39 | Correct | 6 ms | 376 KB | Output is correct |
40 | Correct | 5 ms | 376 KB | Output is correct |
41 | Correct | 5 ms | 376 KB | Output is correct |
42 | Correct | 6 ms | 376 KB | Output is correct |
43 | Correct | 6 ms | 376 KB | Output is correct |
44 | Correct | 6 ms | 376 KB | Output is correct |
45 | Correct | 6 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 248 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 380 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 380 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 376 KB | Output is correct |
16 | Correct | 5 ms | 376 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 380 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 6 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 5 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 376 KB | Output is correct |
26 | Correct | 5 ms | 376 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 5 ms | 376 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 5 ms | 376 KB | Output is correct |
33 | Correct | 6 ms | 376 KB | Output is correct |
34 | Correct | 6 ms | 376 KB | Output is correct |
35 | Correct | 6 ms | 376 KB | Output is correct |
36 | Correct | 6 ms | 376 KB | Output is correct |
37 | Correct | 5 ms | 376 KB | Output is correct |
38 | Correct | 6 ms | 376 KB | Output is correct |
39 | Correct | 6 ms | 376 KB | Output is correct |
40 | Correct | 5 ms | 376 KB | Output is correct |
41 | Correct | 5 ms | 376 KB | Output is correct |
42 | Correct | 6 ms | 376 KB | Output is correct |
43 | Correct | 6 ms | 376 KB | Output is correct |
44 | Correct | 6 ms | 376 KB | Output is correct |
45 | Correct | 6 ms | 376 KB | Output is correct |
46 | Correct | 26 ms | 3064 KB | Output is correct |
47 | Correct | 26 ms | 2552 KB | Output is correct |
48 | Correct | 36 ms | 1656 KB | Output is correct |
49 | Correct | 34 ms | 2296 KB | Output is correct |
50 | Correct | 29 ms | 3064 KB | Output is correct |
51 | Correct | 33 ms | 2680 KB | Output is correct |
52 | Correct | 18 ms | 1528 KB | Output is correct |
53 | Correct | 13 ms | 1016 KB | Output is correct |
54 | Correct | 24 ms | 2680 KB | Output is correct |
55 | Correct | 30 ms | 2936 KB | Output is correct |
56 | Correct | 28 ms | 3064 KB | Output is correct |
57 | Correct | 27 ms | 2936 KB | Output is correct |
58 | Correct | 26 ms | 2808 KB | Output is correct |
59 | Correct | 27 ms | 3064 KB | Output is correct |
60 | Correct | 26 ms | 3064 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 248 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 380 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 380 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 376 KB | Output is correct |
16 | Correct | 5 ms | 376 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 380 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 6 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 5 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 376 KB | Output is correct |
26 | Correct | 5 ms | 376 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 5 ms | 376 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 5 ms | 376 KB | Output is correct |
33 | Correct | 6 ms | 376 KB | Output is correct |
34 | Correct | 6 ms | 376 KB | Output is correct |
35 | Correct | 6 ms | 376 KB | Output is correct |
36 | Correct | 6 ms | 376 KB | Output is correct |
37 | Correct | 5 ms | 376 KB | Output is correct |
38 | Correct | 6 ms | 376 KB | Output is correct |
39 | Correct | 6 ms | 376 KB | Output is correct |
40 | Correct | 5 ms | 376 KB | Output is correct |
41 | Correct | 5 ms | 376 KB | Output is correct |
42 | Correct | 6 ms | 376 KB | Output is correct |
43 | Correct | 6 ms | 376 KB | Output is correct |
44 | Correct | 6 ms | 376 KB | Output is correct |
45 | Correct | 6 ms | 376 KB | Output is correct |
46 | Correct | 26 ms | 3064 KB | Output is correct |
47 | Correct | 26 ms | 2552 KB | Output is correct |
48 | Correct | 36 ms | 1656 KB | Output is correct |
49 | Correct | 34 ms | 2296 KB | Output is correct |
50 | Correct | 29 ms | 3064 KB | Output is correct |
51 | Correct | 33 ms | 2680 KB | Output is correct |
52 | Correct | 18 ms | 1528 KB | Output is correct |
53 | Correct | 13 ms | 1016 KB | Output is correct |
54 | Correct | 24 ms | 2680 KB | Output is correct |
55 | Correct | 30 ms | 2936 KB | Output is correct |
56 | Correct | 28 ms | 3064 KB | Output is correct |
57 | Correct | 27 ms | 2936 KB | Output is correct |
58 | Correct | 26 ms | 2808 KB | Output is correct |
59 | Correct | 27 ms | 3064 KB | Output is correct |
60 | Correct | 26 ms | 3064 KB | Output is correct |
61 | Correct | 128 ms | 14072 KB | Output is correct |
62 | Correct | 125 ms | 13944 KB | Output is correct |
63 | Correct | 133 ms | 14200 KB | Output is correct |
64 | Correct | 131 ms | 12284 KB | Output is correct |
65 | Correct | 130 ms | 18936 KB | Output is correct |
66 | Correct | 145 ms | 17272 KB | Output is correct |
67 | Correct | 119 ms | 14140 KB | Output is correct |
68 | Correct | 62 ms | 7160 KB | Output is correct |
69 | Correct | 99 ms | 12920 KB | Output is correct |
70 | Correct | 134 ms | 18424 KB | Output is correct |
71 | Correct | 114 ms | 16200 KB | Output is correct |
72 | Correct | 118 ms | 14840 KB | Output is correct |
73 | Correct | 121 ms | 15736 KB | Output is correct |
74 | Correct | 120 ms | 17276 KB | Output is correct |
75 | Correct | 119 ms | 17400 KB | Output is correct |