Submission #1224133

#TimeUsernameProblemLanguageResultExecution timeMemory
1224133sleepntsheepKitchen (BOI19_kitchen)C++17
20 / 100
34 ms1352 KiB
#include <stdio.h> #define N 405 int x, n, m, k, a[N], b[N], dp[999999]; int main() { scanf("%d%d%d", &n, &m, &k); for (int i = 0; i < n; ++i) scanf("%d", &a[i]), x += a[i]; for (int i = 0; i < m; ++i) scanf("%d", &b[i]); dp[0] = 1; for (int i = 0; i < m; ++i) { for (int j = 250000; j >= b[i]; --j) { dp[j] |= dp[j - b[i]]; } } for (int h = 0; x + h < 250000; ++h) { if (dp[x + h]) { printf("%d\n", h); return 0; } } puts("Impossible"); return 0; }

Compilation message (stderr)

kitchen.cpp: In function 'int main()':
kitchen.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%d%d%d", &n, &m, &k);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
kitchen.cpp:10:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |                 scanf("%d", &a[i]), x += a[i];
      |                 ~~~~~^~~~~~~~~~~~~
kitchen.cpp:13:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |                 scanf("%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...