# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
493509 | 2021-12-11T19:07:24 Z | Homichki | Bigger segments (IZhO19_segments) | C++14 | 94 ms | 2680 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); //ifstream cin("input.txt"); //ofstream cout("output.txt"); ll k,m,x1,y1,p,qqq,i,j,z,x,y,l,r,kry,w,sum,t,n,h,mew,ma,kol; vector<ll> a,b; vector<pair<ll,ll> > dp(3000); string s; char s1; cin>>n; for(i=0;i<n;i++) { cin>>x; a.push_back(x); } dp[0]={1,a[0]}; for(i=1;i<n;i++) { sum=0; for(j=i;j>=0;j--) { sum+=a[j]; if(j==0) { if(dp[i].first<1) { dp[i]={1,sum}; } } else { if((dp[j-1].first+1>dp[i].first) && (sum>=dp[j-1].second)) { dp[i]={dp[j-1].first+1,sum}; } else { if((dp[j-1].first+1==dp[i].first) && (sum<dp[i].second) && (sum>=dp[j-1].second)) { dp[i]={dp[i].first,sum}; } } } } } cout<<dp[n-1].first; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 0 ms | 332 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 356 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 0 ms | 332 KB | Output is correct |
9 | Correct | 0 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 332 KB | Output is correct |
11 | Correct | 0 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 0 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 0 ms | 332 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 356 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 0 ms | 332 KB | Output is correct |
9 | Correct | 0 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 332 KB | Output is correct |
11 | Correct | 0 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 0 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 0 ms | 332 KB | Output is correct |
24 | Correct | 1 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
27 | Correct | 1 ms | 332 KB | Output is correct |
28 | Correct | 1 ms | 332 KB | Output is correct |
29 | Correct | 1 ms | 332 KB | Output is correct |
30 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 0 ms | 332 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 356 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 0 ms | 332 KB | Output is correct |
9 | Correct | 0 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 332 KB | Output is correct |
11 | Correct | 0 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 0 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 0 ms | 332 KB | Output is correct |
24 | Correct | 1 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
27 | Correct | 1 ms | 332 KB | Output is correct |
28 | Correct | 1 ms | 332 KB | Output is correct |
29 | Correct | 1 ms | 332 KB | Output is correct |
30 | Correct | 1 ms | 332 KB | Output is correct |
31 | Correct | 5 ms | 332 KB | Output is correct |
32 | Correct | 5 ms | 332 KB | Output is correct |
33 | Correct | 6 ms | 332 KB | Output is correct |
34 | Correct | 6 ms | 376 KB | Output is correct |
35 | Correct | 6 ms | 332 KB | Output is correct |
36 | Correct | 5 ms | 332 KB | Output is correct |
37 | Correct | 4 ms | 448 KB | Output is correct |
38 | Correct | 3 ms | 332 KB | Output is correct |
39 | Correct | 5 ms | 332 KB | Output is correct |
40 | Correct | 6 ms | 332 KB | Output is correct |
41 | Correct | 6 ms | 332 KB | Output is correct |
42 | Correct | 6 ms | 332 KB | Output is correct |
43 | Correct | 7 ms | 332 KB | Output is correct |
44 | Correct | 5 ms | 332 KB | Output is correct |
45 | Correct | 6 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 0 ms | 332 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 356 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 0 ms | 332 KB | Output is correct |
9 | Correct | 0 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 332 KB | Output is correct |
11 | Correct | 0 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 0 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 0 ms | 332 KB | Output is correct |
24 | Correct | 1 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
27 | Correct | 1 ms | 332 KB | Output is correct |
28 | Correct | 1 ms | 332 KB | Output is correct |
29 | Correct | 1 ms | 332 KB | Output is correct |
30 | Correct | 1 ms | 332 KB | Output is correct |
31 | Correct | 5 ms | 332 KB | Output is correct |
32 | Correct | 5 ms | 332 KB | Output is correct |
33 | Correct | 6 ms | 332 KB | Output is correct |
34 | Correct | 6 ms | 376 KB | Output is correct |
35 | Correct | 6 ms | 332 KB | Output is correct |
36 | Correct | 5 ms | 332 KB | Output is correct |
37 | Correct | 4 ms | 448 KB | Output is correct |
38 | Correct | 3 ms | 332 KB | Output is correct |
39 | Correct | 5 ms | 332 KB | Output is correct |
40 | Correct | 6 ms | 332 KB | Output is correct |
41 | Correct | 6 ms | 332 KB | Output is correct |
42 | Correct | 6 ms | 332 KB | Output is correct |
43 | Correct | 7 ms | 332 KB | Output is correct |
44 | Correct | 5 ms | 332 KB | Output is correct |
45 | Correct | 6 ms | 332 KB | Output is correct |
46 | Runtime error | 94 ms | 2680 KB | Execution killed with signal 11 |
47 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 0 ms | 332 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 356 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 0 ms | 332 KB | Output is correct |
9 | Correct | 0 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 332 KB | Output is correct |
11 | Correct | 0 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 0 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 0 ms | 332 KB | Output is correct |
24 | Correct | 1 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
27 | Correct | 1 ms | 332 KB | Output is correct |
28 | Correct | 1 ms | 332 KB | Output is correct |
29 | Correct | 1 ms | 332 KB | Output is correct |
30 | Correct | 1 ms | 332 KB | Output is correct |
31 | Correct | 5 ms | 332 KB | Output is correct |
32 | Correct | 5 ms | 332 KB | Output is correct |
33 | Correct | 6 ms | 332 KB | Output is correct |
34 | Correct | 6 ms | 376 KB | Output is correct |
35 | Correct | 6 ms | 332 KB | Output is correct |
36 | Correct | 5 ms | 332 KB | Output is correct |
37 | Correct | 4 ms | 448 KB | Output is correct |
38 | Correct | 3 ms | 332 KB | Output is correct |
39 | Correct | 5 ms | 332 KB | Output is correct |
40 | Correct | 6 ms | 332 KB | Output is correct |
41 | Correct | 6 ms | 332 KB | Output is correct |
42 | Correct | 6 ms | 332 KB | Output is correct |
43 | Correct | 7 ms | 332 KB | Output is correct |
44 | Correct | 5 ms | 332 KB | Output is correct |
45 | Correct | 6 ms | 332 KB | Output is correct |
46 | Runtime error | 94 ms | 2680 KB | Execution killed with signal 11 |
47 | Halted | 0 ms | 0 KB | - |