Submission #719580

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7195802023-04-06 10:05:04jamezzzKitchen (BOI19_kitchen)C++17
100 / 100
291 ms111436 KiB
#include <bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf
#define INF 1023456789
#define maxn 305
int n,m,k,a[maxn],b[maxn],memo[maxn][maxn*maxn+5];
int dp(int i,int num){
if(num<0)return -INF;
if(i==-1&&num==0)return 0;
if(i==-1&&num!=0)return -INF;
if(memo[i][num]!=-1)return memo[i][num];
return memo[i][num]=max(dp(i-1,num),dp(i-1,num-b[i])+min(n,b[i]));
}
int main(){
sf("%d%d%d",&n,&m,&k);
int sm=0;
for(int i=0;i<n;++i){
sf("%d",&a[i]);
if(a[i]<k){
printf("Impossible\n");
exit(0);
}
sm+=a[i];
}
int sm2=0;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

kitchen.cpp: In function 'int main()':
kitchen.cpp:20:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  sf("%d%d%d",&n,&m,&k);
      |    ^
kitchen.cpp:23:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |   sf("%d",&a[i]);
      |     ^
kitchen.cpp:32:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |   sf("%d",&b[i]);
      |     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...