제출 #522787

#제출 시각아이디문제언어결과실행 시간메모리
522787LucaDantasKitchen (BOI19_kitchen)C++17
0 / 100
1 ms204 KiB
#include <cstdio> #include <algorithm> using namespace std; constexpr int maxn = 310, inf = 0x3f3f3f3f; int a[maxn], b[maxn], ex[maxn]; int dp[maxn*maxn]; int main() { int n, m, k, soma = 0; scanf("%d %d %d", &n, &m, &k); for(int i = 0; i < n; i++) { scanf("%d", a+i), soma += a[i]; if(a[i] < k) return puts("impossible"), 0; } for(int i = 0; i < m; i++) scanf("%d", b+i); int ans = inf; for(int mask = 0; mask < (1 << m); mask++) { int tot = 0, bom = 0; for(int i = 0; i < m; i++) if(mask & (1 << i)) tot += b[i], bom += min(n, b[i]); if(tot >= soma && bom >= n*k) ans = min(ans, tot); } if(ans == inf) puts("impossible"); else printf("%d\n", ans-soma); }

컴파일 시 표준 에러 (stderr) 메시지

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