제출 #1005466

#제출 시각아이디문제언어결과실행 시간메모리
1005466vjudge1Kitchen (BOI19_kitchen)C++17
20 / 100
17 ms1112 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int inf = 1e18; int n, m, k, res; int s1, s2, s3, s4, s5, s6, s7, l; int dp[100001]; int b[301]; void test(){ for(int i = 1; i <= m; i++){ for(int j = s4 - b[i]; j >= 0; --j) if(dp[j] != inf) dp[j + b[i]] = max(dp[j + b[i]], dp[j] + min(b[i], n)); } s3 = inf; for(int j = s2;j <= s4; j++) if(dp[j] >= n * k) s3 = min(s3, j - s2); } void solve(){ cin >> n >> m >> k; s7 = inf; for(int i = 1; i <= n; i++){ cin >> l; s2 += l; s7 = min(s7, l); } for(int i = 1; i <= m; i++){ cin >> b[i]; s4 += b[i]; } for(int i = 0; i <= s4; i++) dp[i] = -inf; if(s7 < k){ cout << "Imposible"; exit(0); } dp[0] = 0; test(); if(s3 != inf) cout << s3; else cout << "Impossible"; } signed main(){ solve(); }

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

kitchen.cpp: In function 'void solve()':
kitchen.cpp:32:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   32 |     for(int i = 0; i <= s4; i++)
      |     ^~~
kitchen.cpp:34:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   34 |         if(s7 < k){
      |         ^~
#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...