#include <bits/stdc++.h>
#define li 105
#define inf 100000000000009
#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;
lo int sum[li],A[li],dp[li][li][li][25];
lo int dfs(int sira,int l,int r,int gs){
//printf("%d %d %d %d\n",sira,l,r,gs);
lo 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("%lld",&A[i]);sum[i]=sum[i-1]+A[i];}
lo int ty=dfs(1,1,1,1);
printf("%lld\n",ty);
return 0;
}
//~ 6 1 3
//~ 8 1 2 1 5 4
Compilation message
sculpture.cpp: In function 'int main()':
sculpture.cpp:31: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:32: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("%lld",&A[i]);sum[i]=sum[i-1]+A[i];}
~~~~~^~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
183 ms |
226936 KB |
Output is correct |
2 |
Correct |
185 ms |
226964 KB |
Output is correct |
3 |
Correct |
180 ms |
227016 KB |
Output is correct |
4 |
Correct |
190 ms |
227016 KB |
Output is correct |
5 |
Correct |
183 ms |
227016 KB |
Output is correct |
6 |
Correct |
189 ms |
227024 KB |
Output is correct |
7 |
Correct |
183 ms |
227024 KB |
Output is correct |
8 |
Correct |
178 ms |
227024 KB |
Output is correct |
9 |
Correct |
178 ms |
227152 KB |
Output is correct |
10 |
Correct |
178 ms |
227152 KB |
Output is correct |
11 |
Correct |
179 ms |
227152 KB |
Output is correct |
12 |
Correct |
181 ms |
227152 KB |
Output is correct |
13 |
Correct |
181 ms |
227224 KB |
Output is correct |
14 |
Correct |
182 ms |
227224 KB |
Output is correct |
15 |
Correct |
185 ms |
227224 KB |
Output is correct |
16 |
Correct |
179 ms |
227224 KB |
Output is correct |
17 |
Correct |
184 ms |
227224 KB |
Output is correct |
18 |
Correct |
191 ms |
227224 KB |
Output is correct |
19 |
Correct |
185 ms |
227224 KB |
Output is correct |
20 |
Correct |
188 ms |
227224 KB |
Output is correct |
21 |
Incorrect |
181 ms |
227324 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
204 ms |
227324 KB |
Output is correct |
2 |
Correct |
182 ms |
227324 KB |
Output is correct |
3 |
Correct |
198 ms |
227324 KB |
Output is correct |
4 |
Correct |
185 ms |
227324 KB |
Output is correct |
5 |
Correct |
183 ms |
227324 KB |
Output is correct |
6 |
Correct |
203 ms |
227324 KB |
Output is correct |
7 |
Correct |
185 ms |
227324 KB |
Output is correct |
8 |
Correct |
185 ms |
227324 KB |
Output is correct |
9 |
Correct |
191 ms |
227324 KB |
Output is correct |
10 |
Correct |
189 ms |
227324 KB |
Output is correct |
11 |
Correct |
186 ms |
227324 KB |
Output is correct |
12 |
Correct |
188 ms |
227324 KB |
Output is correct |
13 |
Correct |
184 ms |
227324 KB |
Output is correct |
14 |
Correct |
188 ms |
227324 KB |
Output is correct |
15 |
Correct |
187 ms |
227324 KB |
Output is correct |
16 |
Correct |
189 ms |
227324 KB |
Output is correct |
17 |
Correct |
184 ms |
227324 KB |
Output is correct |
18 |
Correct |
194 ms |
227324 KB |
Output is correct |
19 |
Correct |
187 ms |
227324 KB |
Output is correct |
20 |
Correct |
187 ms |
227324 KB |
Output is correct |
21 |
Incorrect |
194 ms |
227324 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
186 ms |
227324 KB |
Output is correct |
2 |
Correct |
184 ms |
227324 KB |
Output is correct |
3 |
Correct |
189 ms |
227324 KB |
Output is correct |
4 |
Correct |
186 ms |
227324 KB |
Output is correct |
5 |
Correct |
185 ms |
227324 KB |
Output is correct |
6 |
Correct |
187 ms |
227324 KB |
Output is correct |
7 |
Correct |
188 ms |
227324 KB |
Output is correct |
8 |
Correct |
192 ms |
227324 KB |
Output is correct |
9 |
Correct |
185 ms |
227324 KB |
Output is correct |
10 |
Correct |
191 ms |
227324 KB |
Output is correct |
11 |
Correct |
184 ms |
227324 KB |
Output is correct |
12 |
Correct |
189 ms |
227324 KB |
Output is correct |
13 |
Correct |
193 ms |
227324 KB |
Output is correct |
14 |
Correct |
199 ms |
227324 KB |
Output is correct |
15 |
Correct |
190 ms |
227324 KB |
Output is correct |
16 |
Correct |
191 ms |
227324 KB |
Output is correct |
17 |
Correct |
183 ms |
227324 KB |
Output is correct |
18 |
Correct |
187 ms |
227324 KB |
Output is correct |
19 |
Correct |
185 ms |
227324 KB |
Output is correct |
20 |
Correct |
187 ms |
227324 KB |
Output is correct |
21 |
Correct |
187 ms |
227324 KB |
Output is correct |
22 |
Correct |
186 ms |
227324 KB |
Output is correct |
23 |
Correct |
187 ms |
227324 KB |
Output is correct |
24 |
Correct |
197 ms |
227324 KB |
Output is correct |
25 |
Correct |
186 ms |
227324 KB |
Output is correct |
26 |
Correct |
195 ms |
227324 KB |
Output is correct |
27 |
Correct |
191 ms |
227324 KB |
Output is correct |
28 |
Correct |
195 ms |
227324 KB |
Output is correct |
29 |
Correct |
187 ms |
227324 KB |
Output is correct |
30 |
Correct |
182 ms |
227324 KB |
Output is correct |
31 |
Correct |
188 ms |
227324 KB |
Output is correct |
32 |
Correct |
191 ms |
227324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
185 ms |
227324 KB |
Output is correct |
2 |
Correct |
188 ms |
227324 KB |
Output is correct |
3 |
Correct |
190 ms |
227324 KB |
Output is correct |
4 |
Correct |
184 ms |
227324 KB |
Output is correct |
5 |
Correct |
186 ms |
227324 KB |
Output is correct |
6 |
Correct |
186 ms |
227324 KB |
Output is correct |
7 |
Correct |
186 ms |
227324 KB |
Output is correct |
8 |
Correct |
183 ms |
227324 KB |
Output is correct |
9 |
Correct |
187 ms |
227324 KB |
Output is correct |
10 |
Correct |
183 ms |
227324 KB |
Output is correct |
11 |
Correct |
187 ms |
227324 KB |
Output is correct |
12 |
Correct |
186 ms |
227324 KB |
Output is correct |
13 |
Correct |
187 ms |
227324 KB |
Output is correct |
14 |
Correct |
183 ms |
227324 KB |
Output is correct |
15 |
Correct |
190 ms |
227324 KB |
Output is correct |
16 |
Correct |
188 ms |
227324 KB |
Output is correct |
17 |
Correct |
199 ms |
227324 KB |
Output is correct |
18 |
Correct |
203 ms |
227324 KB |
Output is correct |
19 |
Correct |
188 ms |
227324 KB |
Output is correct |
20 |
Correct |
184 ms |
227324 KB |
Output is correct |
21 |
Incorrect |
186 ms |
227324 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
192 ms |
227324 KB |
Output is correct |
2 |
Correct |
188 ms |
227324 KB |
Output is correct |
3 |
Correct |
186 ms |
227324 KB |
Output is correct |
4 |
Correct |
185 ms |
227324 KB |
Output is correct |
5 |
Correct |
191 ms |
227324 KB |
Output is correct |
6 |
Correct |
203 ms |
227324 KB |
Output is correct |
7 |
Correct |
191 ms |
227324 KB |
Output is correct |
8 |
Correct |
197 ms |
227324 KB |
Output is correct |
9 |
Correct |
193 ms |
227324 KB |
Output is correct |
10 |
Correct |
189 ms |
227324 KB |
Output is correct |
11 |
Correct |
185 ms |
227324 KB |
Output is correct |
12 |
Correct |
188 ms |
227324 KB |
Output is correct |
13 |
Correct |
184 ms |
227324 KB |
Output is correct |
14 |
Correct |
189 ms |
227324 KB |
Output is correct |
15 |
Correct |
188 ms |
227324 KB |
Output is correct |
16 |
Correct |
186 ms |
227324 KB |
Output is correct |
17 |
Correct |
191 ms |
227324 KB |
Output is correct |
18 |
Incorrect |
190 ms |
227324 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |