# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
173537 | 2020-01-04T14:17:06 Z | mosiashvililuka | Bigger segments (IZhO19_segments) | C++14 | 495 ms | 44072 KB |
#include<bits/stdc++.h> using namespace std; long long a,b,c,d,e,f[500009],i,j,mxf,mxs,pas; pair <long long, long long> dp[500009]; vector <pair <long long, long long> > v[500009]; int main(){ scanf("%I64d\n",&a); for(i=1; i<=a; i++) scanf("%I64d",&f[i]); for(i=1; i<=a; i++) f[i]+=f[i-1]; scanf("\n"); mxs=1000000000000000000LL; f[a+1]=mxs; mxs=0; for(b=1; b<=a; b++){ for(i=0; i<v[b].size(); i++){ if(mxf<v[b][i].first){ mxf=v[b][i].first;mxs=v[b][i].second; }else{ if(mxf==v[b][i].first&&mxs<v[b][i].second){ mxs=v[b][i].second; } } } dp[b].first=1;dp[b].second=f[b]; if(mxf>dp[b].first){ dp[b].first=mxf; dp[b].second=f[b]-mxs; }else{ if(mxf==dp[b].first&&f[b]-mxs<dp[b].second) dp[b].second=f[b]-mxs; } c=lower_bound(f+1,f+a+1,dp[b].second+f[b])-f; if(c<=a){ // cout<<b<<" "<<c<<" "<<dp[b].first<<" "<<f[c]<<endl; v[c].push_back(make_pair(dp[b].first+1,f[b])); } if(pas<dp[b].first) pas=dp[b].first; } cout<<pas; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 12024 KB | Output is correct |
2 | Correct | 13 ms | 12024 KB | Output is correct |
3 | Correct | 13 ms | 12024 KB | Output is correct |
4 | Correct | 12 ms | 12024 KB | Output is correct |
5 | Correct | 13 ms | 12024 KB | Output is correct |
6 | Correct | 12 ms | 11896 KB | Output is correct |
7 | Correct | 13 ms | 12028 KB | Output is correct |
8 | Correct | 13 ms | 12024 KB | Output is correct |
9 | Correct | 13 ms | 12024 KB | Output is correct |
10 | Correct | 12 ms | 12024 KB | Output is correct |
11 | Correct | 13 ms | 12152 KB | Output is correct |
12 | Correct | 12 ms | 12152 KB | Output is correct |
13 | Correct | 12 ms | 12152 KB | Output is correct |
14 | Correct | 13 ms | 12152 KB | Output is correct |
15 | Correct | 13 ms | 12152 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 12024 KB | Output is correct |
2 | Correct | 13 ms | 12024 KB | Output is correct |
3 | Correct | 13 ms | 12024 KB | Output is correct |
4 | Correct | 12 ms | 12024 KB | Output is correct |
5 | Correct | 13 ms | 12024 KB | Output is correct |
6 | Correct | 12 ms | 11896 KB | Output is correct |
7 | Correct | 13 ms | 12028 KB | Output is correct |
8 | Correct | 13 ms | 12024 KB | Output is correct |
9 | Correct | 13 ms | 12024 KB | Output is correct |
10 | Correct | 12 ms | 12024 KB | Output is correct |
11 | Correct | 13 ms | 12152 KB | Output is correct |
12 | Correct | 12 ms | 12152 KB | Output is correct |
13 | Correct | 12 ms | 12152 KB | Output is correct |
14 | Correct | 13 ms | 12152 KB | Output is correct |
15 | Correct | 13 ms | 12152 KB | Output is correct |
16 | Correct | 13 ms | 12152 KB | Output is correct |
17 | Correct | 13 ms | 12024 KB | Output is correct |
18 | Correct | 13 ms | 12152 KB | Output is correct |
19 | Correct | 13 ms | 12156 KB | Output is correct |
20 | Correct | 13 ms | 12152 KB | Output is correct |
21 | Correct | 13 ms | 12024 KB | Output is correct |
22 | Correct | 13 ms | 12152 KB | Output is correct |
23 | Correct | 14 ms | 12024 KB | Output is correct |
24 | Correct | 17 ms | 12152 KB | Output is correct |
25 | Correct | 14 ms | 12024 KB | Output is correct |
26 | Correct | 13 ms | 12152 KB | Output is correct |
27 | Correct | 14 ms | 12024 KB | Output is correct |
28 | Correct | 13 ms | 12024 KB | Output is correct |
29 | Correct | 15 ms | 12152 KB | Output is correct |
30 | Correct | 13 ms | 12152 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 12024 KB | Output is correct |
2 | Correct | 13 ms | 12024 KB | Output is correct |
3 | Correct | 13 ms | 12024 KB | Output is correct |
4 | Correct | 12 ms | 12024 KB | Output is correct |
5 | Correct | 13 ms | 12024 KB | Output is correct |
6 | Correct | 12 ms | 11896 KB | Output is correct |
7 | Correct | 13 ms | 12028 KB | Output is correct |
8 | Correct | 13 ms | 12024 KB | Output is correct |
9 | Correct | 13 ms | 12024 KB | Output is correct |
10 | Correct | 12 ms | 12024 KB | Output is correct |
11 | Correct | 13 ms | 12152 KB | Output is correct |
12 | Correct | 12 ms | 12152 KB | Output is correct |
13 | Correct | 12 ms | 12152 KB | Output is correct |
14 | Correct | 13 ms | 12152 KB | Output is correct |
15 | Correct | 13 ms | 12152 KB | Output is correct |
16 | Correct | 13 ms | 12152 KB | Output is correct |
17 | Correct | 13 ms | 12024 KB | Output is correct |
18 | Correct | 13 ms | 12152 KB | Output is correct |
19 | Correct | 13 ms | 12156 KB | Output is correct |
20 | Correct | 13 ms | 12152 KB | Output is correct |
21 | Correct | 13 ms | 12024 KB | Output is correct |
22 | Correct | 13 ms | 12152 KB | Output is correct |
23 | Correct | 14 ms | 12024 KB | Output is correct |
24 | Correct | 17 ms | 12152 KB | Output is correct |
25 | Correct | 14 ms | 12024 KB | Output is correct |
26 | Correct | 13 ms | 12152 KB | Output is correct |
27 | Correct | 14 ms | 12024 KB | Output is correct |
28 | Correct | 13 ms | 12024 KB | Output is correct |
29 | Correct | 15 ms | 12152 KB | Output is correct |
30 | Correct | 13 ms | 12152 KB | Output is correct |
31 | Correct | 15 ms | 12152 KB | Output is correct |
32 | Correct | 14 ms | 12280 KB | Output is correct |
33 | Correct | 15 ms | 12280 KB | Output is correct |
34 | Correct | 15 ms | 12152 KB | Output is correct |
35 | Correct | 16 ms | 12272 KB | Output is correct |
36 | Correct | 16 ms | 12280 KB | Output is correct |
37 | Correct | 15 ms | 12152 KB | Output is correct |
38 | Correct | 15 ms | 12152 KB | Output is correct |
39 | Correct | 14 ms | 12152 KB | Output is correct |
40 | Correct | 16 ms | 12280 KB | Output is correct |
41 | Correct | 14 ms | 12280 KB | Output is correct |
42 | Correct | 14 ms | 12280 KB | Output is correct |
43 | Correct | 14 ms | 12256 KB | Output is correct |
44 | Correct | 14 ms | 12280 KB | Output is correct |
45 | Correct | 14 ms | 12280 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 12024 KB | Output is correct |
2 | Correct | 13 ms | 12024 KB | Output is correct |
3 | Correct | 13 ms | 12024 KB | Output is correct |
4 | Correct | 12 ms | 12024 KB | Output is correct |
5 | Correct | 13 ms | 12024 KB | Output is correct |
6 | Correct | 12 ms | 11896 KB | Output is correct |
7 | Correct | 13 ms | 12028 KB | Output is correct |
8 | Correct | 13 ms | 12024 KB | Output is correct |
9 | Correct | 13 ms | 12024 KB | Output is correct |
10 | Correct | 12 ms | 12024 KB | Output is correct |
11 | Correct | 13 ms | 12152 KB | Output is correct |
12 | Correct | 12 ms | 12152 KB | Output is correct |
13 | Correct | 12 ms | 12152 KB | Output is correct |
14 | Correct | 13 ms | 12152 KB | Output is correct |
15 | Correct | 13 ms | 12152 KB | Output is correct |
16 | Correct | 13 ms | 12152 KB | Output is correct |
17 | Correct | 13 ms | 12024 KB | Output is correct |
18 | Correct | 13 ms | 12152 KB | Output is correct |
19 | Correct | 13 ms | 12156 KB | Output is correct |
20 | Correct | 13 ms | 12152 KB | Output is correct |
21 | Correct | 13 ms | 12024 KB | Output is correct |
22 | Correct | 13 ms | 12152 KB | Output is correct |
23 | Correct | 14 ms | 12024 KB | Output is correct |
24 | Correct | 17 ms | 12152 KB | Output is correct |
25 | Correct | 14 ms | 12024 KB | Output is correct |
26 | Correct | 13 ms | 12152 KB | Output is correct |
27 | Correct | 14 ms | 12024 KB | Output is correct |
28 | Correct | 13 ms | 12024 KB | Output is correct |
29 | Correct | 15 ms | 12152 KB | Output is correct |
30 | Correct | 13 ms | 12152 KB | Output is correct |
31 | Correct | 15 ms | 12152 KB | Output is correct |
32 | Correct | 14 ms | 12280 KB | Output is correct |
33 | Correct | 15 ms | 12280 KB | Output is correct |
34 | Correct | 15 ms | 12152 KB | Output is correct |
35 | Correct | 16 ms | 12272 KB | Output is correct |
36 | Correct | 16 ms | 12280 KB | Output is correct |
37 | Correct | 15 ms | 12152 KB | Output is correct |
38 | Correct | 15 ms | 12152 KB | Output is correct |
39 | Correct | 14 ms | 12152 KB | Output is correct |
40 | Correct | 16 ms | 12280 KB | Output is correct |
41 | Correct | 14 ms | 12280 KB | Output is correct |
42 | Correct | 14 ms | 12280 KB | Output is correct |
43 | Correct | 14 ms | 12256 KB | Output is correct |
44 | Correct | 14 ms | 12280 KB | Output is correct |
45 | Correct | 14 ms | 12280 KB | Output is correct |
46 | Correct | 48 ms | 14556 KB | Output is correct |
47 | Correct | 58 ms | 16928 KB | Output is correct |
48 | Correct | 87 ms | 17244 KB | Output is correct |
49 | Correct | 94 ms | 17528 KB | Output is correct |
50 | Correct | 82 ms | 17912 KB | Output is correct |
51 | Correct | 104 ms | 17272 KB | Output is correct |
52 | Correct | 58 ms | 14840 KB | Output is correct |
53 | Correct | 40 ms | 13944 KB | Output is correct |
54 | Correct | 54 ms | 17272 KB | Output is correct |
55 | Correct | 110 ms | 17656 KB | Output is correct |
56 | Correct | 64 ms | 17656 KB | Output is correct |
57 | Correct | 57 ms | 17136 KB | Output is correct |
58 | Correct | 60 ms | 17388 KB | Output is correct |
59 | Correct | 71 ms | 17784 KB | Output is correct |
60 | Correct | 71 ms | 17912 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 12024 KB | Output is correct |
2 | Correct | 13 ms | 12024 KB | Output is correct |
3 | Correct | 13 ms | 12024 KB | Output is correct |
4 | Correct | 12 ms | 12024 KB | Output is correct |
5 | Correct | 13 ms | 12024 KB | Output is correct |
6 | Correct | 12 ms | 11896 KB | Output is correct |
7 | Correct | 13 ms | 12028 KB | Output is correct |
8 | Correct | 13 ms | 12024 KB | Output is correct |
9 | Correct | 13 ms | 12024 KB | Output is correct |
10 | Correct | 12 ms | 12024 KB | Output is correct |
11 | Correct | 13 ms | 12152 KB | Output is correct |
12 | Correct | 12 ms | 12152 KB | Output is correct |
13 | Correct | 12 ms | 12152 KB | Output is correct |
14 | Correct | 13 ms | 12152 KB | Output is correct |
15 | Correct | 13 ms | 12152 KB | Output is correct |
16 | Correct | 13 ms | 12152 KB | Output is correct |
17 | Correct | 13 ms | 12024 KB | Output is correct |
18 | Correct | 13 ms | 12152 KB | Output is correct |
19 | Correct | 13 ms | 12156 KB | Output is correct |
20 | Correct | 13 ms | 12152 KB | Output is correct |
21 | Correct | 13 ms | 12024 KB | Output is correct |
22 | Correct | 13 ms | 12152 KB | Output is correct |
23 | Correct | 14 ms | 12024 KB | Output is correct |
24 | Correct | 17 ms | 12152 KB | Output is correct |
25 | Correct | 14 ms | 12024 KB | Output is correct |
26 | Correct | 13 ms | 12152 KB | Output is correct |
27 | Correct | 14 ms | 12024 KB | Output is correct |
28 | Correct | 13 ms | 12024 KB | Output is correct |
29 | Correct | 15 ms | 12152 KB | Output is correct |
30 | Correct | 13 ms | 12152 KB | Output is correct |
31 | Correct | 15 ms | 12152 KB | Output is correct |
32 | Correct | 14 ms | 12280 KB | Output is correct |
33 | Correct | 15 ms | 12280 KB | Output is correct |
34 | Correct | 15 ms | 12152 KB | Output is correct |
35 | Correct | 16 ms | 12272 KB | Output is correct |
36 | Correct | 16 ms | 12280 KB | Output is correct |
37 | Correct | 15 ms | 12152 KB | Output is correct |
38 | Correct | 15 ms | 12152 KB | Output is correct |
39 | Correct | 14 ms | 12152 KB | Output is correct |
40 | Correct | 16 ms | 12280 KB | Output is correct |
41 | Correct | 14 ms | 12280 KB | Output is correct |
42 | Correct | 14 ms | 12280 KB | Output is correct |
43 | Correct | 14 ms | 12256 KB | Output is correct |
44 | Correct | 14 ms | 12280 KB | Output is correct |
45 | Correct | 14 ms | 12280 KB | Output is correct |
46 | Correct | 48 ms | 14556 KB | Output is correct |
47 | Correct | 58 ms | 16928 KB | Output is correct |
48 | Correct | 87 ms | 17244 KB | Output is correct |
49 | Correct | 94 ms | 17528 KB | Output is correct |
50 | Correct | 82 ms | 17912 KB | Output is correct |
51 | Correct | 104 ms | 17272 KB | Output is correct |
52 | Correct | 58 ms | 14840 KB | Output is correct |
53 | Correct | 40 ms | 13944 KB | Output is correct |
54 | Correct | 54 ms | 17272 KB | Output is correct |
55 | Correct | 110 ms | 17656 KB | Output is correct |
56 | Correct | 64 ms | 17656 KB | Output is correct |
57 | Correct | 57 ms | 17136 KB | Output is correct |
58 | Correct | 60 ms | 17388 KB | Output is correct |
59 | Correct | 71 ms | 17784 KB | Output is correct |
60 | Correct | 71 ms | 17912 KB | Output is correct |
61 | Correct | 184 ms | 25592 KB | Output is correct |
62 | Correct | 206 ms | 30692 KB | Output is correct |
63 | Correct | 258 ms | 35088 KB | Output is correct |
64 | Correct | 444 ms | 38336 KB | Output is correct |
65 | Correct | 375 ms | 44072 KB | Output is correct |
66 | Correct | 465 ms | 40352 KB | Output is correct |
67 | Correct | 384 ms | 33836 KB | Output is correct |
68 | Correct | 193 ms | 23928 KB | Output is correct |
69 | Correct | 223 ms | 37728 KB | Output is correct |
70 | Correct | 495 ms | 40824 KB | Output is correct |
71 | Correct | 239 ms | 41208 KB | Output is correct |
72 | Correct | 246 ms | 38880 KB | Output is correct |
73 | Correct | 289 ms | 41164 KB | Output is correct |
74 | Correct | 316 ms | 42744 KB | Output is correct |
75 | Correct | 318 ms | 42616 KB | Output is correct |