# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
303022 | 2020-09-19T18:36:32 Z | bigg | Kitchen (BOI19_kitchen) | C++14 | 15 ms | 640 KB |
#include<bits/stdc++.h> using namespace std; const int MAXV = 1e5 + 10; int dp[MAXV]; 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; i++){ if(dp[i]){ printf("%d\n", i -soma); return 0; } } printf("Impossible\n"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 640 KB | Output is correct |
2 | Correct | 1 ms | 640 KB | Output is correct |
3 | Correct | 1 ms | 640 KB | Output is correct |
4 | Incorrect | 1 ms | 640 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 640 KB | Output is correct |
2 | Correct | 1 ms | 640 KB | Output is correct |
3 | Correct | 1 ms | 640 KB | Output is correct |
4 | Incorrect | 1 ms | 640 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 640 KB | Output is correct |
2 | Correct | 12 ms | 640 KB | Output is correct |
3 | Correct | 15 ms | 640 KB | Output is correct |
4 | Correct | 15 ms | 640 KB | Output is correct |
5 | Correct | 15 ms | 640 KB | Output is correct |
6 | Correct | 12 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 640 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 640 KB | Output is correct |
2 | Correct | 1 ms | 640 KB | Output is correct |
3 | Correct | 1 ms | 640 KB | Output is correct |
4 | Incorrect | 1 ms | 640 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |