Submission #303021

#TimeUsernameProblemLanguageResultExecution timeMemory
303021biggKitchen (BOI19_kitchen)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const int MAXV = 1e5 + 10; int dp[MAXN]; int a[310], b[310]; int n, m, k; int main(){ scanf("%d %d %d", &n, &m, &k); int soma = 0, mina = 1e9 + 7; for(int i = 1; i <= n; i++){ scanf("%d", &a[i]); mina = min(mina, a[i]); soma += a[i]; } for(int i = 1; i <= m; i+++) scanf("%d", &b[i]); if(mina < k){ printf("Impossible\n"); return 0; } dp[0] = 1; for(int i = 1; i <= m; i++){ for(int j = 90000 - b[i]; j >= 0; j--){ dp[j + b[i]] |= dp[j]; } } for(int i = soma; i <= 90000){ if(dp[i]){ printf("%d\n", i -soma); return 0; } } printf("Impossible\n"); }

Compilation message (stderr)

kitchen.cpp:5:8: error: 'MAXN' was not declared in this scope; did you mean 'MAXV'?
    5 | int dp[MAXN];
      |        ^~~~
      |        MAXV
kitchen.cpp: In function 'int main()':
kitchen.cpp:16:29: error: expected primary-expression before ')' token
   16 |  for(int i = 1; i <= m; i+++) scanf("%d", &b[i]);
      |                             ^
kitchen.cpp:21:2: error: 'dp' was not declared in this scope
   21 |  dp[0] = 1;
      |  ^~
kitchen.cpp:27:30: error: expected ';' before ')' token
   27 |  for(int i = soma; i <= 90000){
      |                              ^
      |                              ;
kitchen.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |  scanf("%d %d %d", &n, &m, &k);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
kitchen.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |   scanf("%d", &a[i]);
      |   ~~~~~^~~~~~~~~~~~~
kitchen.cpp:16:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  for(int i = 1; i <= m; i+++) scanf("%d", &b[i]);
      |                               ~~~~~^~~~~~~~~~~~~