#include <bits/stdc++.h>
#define li 105
#define inf 1000000009
#define md 1000000007
#define lo long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define iii pair< pair<int,int> ,int >
using namespace std;
int n,a,b,sum[li],A[li],dp[li][li][li][25];
int dfs(int sira,int l,int r,int gs){
//printf("%d %d %d %d\n",sira,l,r,gs);
int cev=inf;
if(gs>b) return inf;
if(sira==n+1){
if(gs>=a)
return (sum[n]-sum[l-1]);
else return inf;
}
if(~dp[sira][l][r][gs]) return dp[sira][l][r][gs];
cev=min(cev,dfs(sira+1,l,r+1,gs));
if(sira<n)
cev=min(cev,dfs(sira+1,r+1,r+1,gs+1)|(sum[r]-sum[l-1]));
return dp[sira][l][r][gs]=cev;
}
int main(){
memset(dp,-1,sizeof(dp));
scanf("%d %d %d",&n,&a,&b);
for(int i=1;i<=n;i++) {scanf("%d",&A[i]);sum[i]=sum[i-1]+A[i];}
int ty=dfs(1,1,1,1);
printf("%d\n",ty);
return 0;
}
//~ 6 1 3
//~ 8 1 2 1 5 4
Compilation message
sculpture.cpp: In function 'int main()':
sculpture.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %d",&n,&a,&b);
~~~~~^~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:31:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
for(int i=1;i<=n;i++) {scanf("%d",&A[i]);sum[i]=sum[i-1]+A[i];}
~~~~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
113656 KB |
Output is correct |
2 |
Correct |
94 ms |
113664 KB |
Output is correct |
3 |
Correct |
95 ms |
113728 KB |
Output is correct |
4 |
Correct |
95 ms |
113748 KB |
Output is correct |
5 |
Correct |
92 ms |
113748 KB |
Output is correct |
6 |
Correct |
94 ms |
113748 KB |
Output is correct |
7 |
Correct |
94 ms |
113748 KB |
Output is correct |
8 |
Correct |
94 ms |
113828 KB |
Output is correct |
9 |
Correct |
93 ms |
113828 KB |
Output is correct |
10 |
Correct |
97 ms |
113980 KB |
Output is correct |
11 |
Correct |
97 ms |
113980 KB |
Output is correct |
12 |
Correct |
95 ms |
114044 KB |
Output is correct |
13 |
Correct |
93 ms |
114044 KB |
Output is correct |
14 |
Correct |
93 ms |
114044 KB |
Output is correct |
15 |
Correct |
94 ms |
114044 KB |
Output is correct |
16 |
Correct |
95 ms |
114044 KB |
Output is correct |
17 |
Correct |
99 ms |
114044 KB |
Output is correct |
18 |
Correct |
110 ms |
114044 KB |
Output is correct |
19 |
Correct |
92 ms |
114044 KB |
Output is correct |
20 |
Correct |
94 ms |
114044 KB |
Output is correct |
21 |
Incorrect |
94 ms |
114044 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
97 ms |
114044 KB |
Output is correct |
2 |
Correct |
94 ms |
114136 KB |
Output is correct |
3 |
Correct |
94 ms |
114136 KB |
Output is correct |
4 |
Correct |
94 ms |
114136 KB |
Output is correct |
5 |
Correct |
99 ms |
114136 KB |
Output is correct |
6 |
Correct |
93 ms |
114136 KB |
Output is correct |
7 |
Correct |
93 ms |
114136 KB |
Output is correct |
8 |
Correct |
92 ms |
114136 KB |
Output is correct |
9 |
Correct |
95 ms |
114136 KB |
Output is correct |
10 |
Correct |
93 ms |
114136 KB |
Output is correct |
11 |
Correct |
117 ms |
114136 KB |
Output is correct |
12 |
Correct |
102 ms |
114136 KB |
Output is correct |
13 |
Correct |
94 ms |
114136 KB |
Output is correct |
14 |
Correct |
94 ms |
114136 KB |
Output is correct |
15 |
Correct |
94 ms |
114136 KB |
Output is correct |
16 |
Correct |
93 ms |
114136 KB |
Output is correct |
17 |
Correct |
98 ms |
114136 KB |
Output is correct |
18 |
Correct |
94 ms |
114136 KB |
Output is correct |
19 |
Correct |
101 ms |
114136 KB |
Output is correct |
20 |
Correct |
98 ms |
114136 KB |
Output is correct |
21 |
Incorrect |
96 ms |
114136 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
114136 KB |
Output is correct |
2 |
Correct |
92 ms |
114136 KB |
Output is correct |
3 |
Correct |
92 ms |
114136 KB |
Output is correct |
4 |
Correct |
96 ms |
114136 KB |
Output is correct |
5 |
Correct |
97 ms |
114136 KB |
Output is correct |
6 |
Correct |
94 ms |
114136 KB |
Output is correct |
7 |
Correct |
93 ms |
114136 KB |
Output is correct |
8 |
Correct |
94 ms |
114136 KB |
Output is correct |
9 |
Correct |
103 ms |
114136 KB |
Output is correct |
10 |
Correct |
95 ms |
114136 KB |
Output is correct |
11 |
Correct |
97 ms |
114136 KB |
Output is correct |
12 |
Correct |
95 ms |
114136 KB |
Output is correct |
13 |
Correct |
96 ms |
114136 KB |
Output is correct |
14 |
Correct |
94 ms |
114136 KB |
Output is correct |
15 |
Correct |
97 ms |
114136 KB |
Output is correct |
16 |
Correct |
99 ms |
114144 KB |
Output is correct |
17 |
Correct |
95 ms |
114144 KB |
Output is correct |
18 |
Correct |
94 ms |
114152 KB |
Output is correct |
19 |
Correct |
94 ms |
114152 KB |
Output is correct |
20 |
Correct |
102 ms |
114152 KB |
Output is correct |
21 |
Correct |
97 ms |
114152 KB |
Output is correct |
22 |
Correct |
94 ms |
114172 KB |
Output is correct |
23 |
Correct |
94 ms |
114172 KB |
Output is correct |
24 |
Correct |
94 ms |
114172 KB |
Output is correct |
25 |
Correct |
95 ms |
114172 KB |
Output is correct |
26 |
Correct |
97 ms |
114172 KB |
Output is correct |
27 |
Correct |
97 ms |
114192 KB |
Output is correct |
28 |
Correct |
104 ms |
114196 KB |
Output is correct |
29 |
Correct |
104 ms |
114196 KB |
Output is correct |
30 |
Correct |
100 ms |
114196 KB |
Output is correct |
31 |
Correct |
96 ms |
114196 KB |
Output is correct |
32 |
Correct |
98 ms |
114196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
114196 KB |
Output is correct |
2 |
Correct |
94 ms |
114196 KB |
Output is correct |
3 |
Correct |
94 ms |
114220 KB |
Output is correct |
4 |
Correct |
92 ms |
114220 KB |
Output is correct |
5 |
Correct |
92 ms |
114220 KB |
Output is correct |
6 |
Correct |
93 ms |
114220 KB |
Output is correct |
7 |
Correct |
95 ms |
114220 KB |
Output is correct |
8 |
Correct |
105 ms |
114220 KB |
Output is correct |
9 |
Correct |
95 ms |
114220 KB |
Output is correct |
10 |
Correct |
95 ms |
114224 KB |
Output is correct |
11 |
Correct |
93 ms |
114260 KB |
Output is correct |
12 |
Correct |
98 ms |
114260 KB |
Output is correct |
13 |
Correct |
94 ms |
114260 KB |
Output is correct |
14 |
Correct |
94 ms |
114260 KB |
Output is correct |
15 |
Correct |
94 ms |
114260 KB |
Output is correct |
16 |
Correct |
102 ms |
114268 KB |
Output is correct |
17 |
Correct |
94 ms |
114268 KB |
Output is correct |
18 |
Correct |
93 ms |
114268 KB |
Output is correct |
19 |
Correct |
94 ms |
114268 KB |
Output is correct |
20 |
Correct |
96 ms |
114268 KB |
Output is correct |
21 |
Incorrect |
95 ms |
114288 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
114288 KB |
Output is correct |
2 |
Correct |
92 ms |
114292 KB |
Output is correct |
3 |
Correct |
96 ms |
114292 KB |
Output is correct |
4 |
Correct |
94 ms |
114292 KB |
Output is correct |
5 |
Correct |
98 ms |
114292 KB |
Output is correct |
6 |
Correct |
96 ms |
114292 KB |
Output is correct |
7 |
Correct |
94 ms |
114292 KB |
Output is correct |
8 |
Correct |
95 ms |
114292 KB |
Output is correct |
9 |
Correct |
98 ms |
114292 KB |
Output is correct |
10 |
Correct |
93 ms |
114408 KB |
Output is correct |
11 |
Correct |
95 ms |
114408 KB |
Output is correct |
12 |
Correct |
94 ms |
114408 KB |
Output is correct |
13 |
Correct |
93 ms |
114408 KB |
Output is correct |
14 |
Incorrect |
94 ms |
114408 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |