| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1099422 | vjudge1 | Kitchen (BOI19_kitchen) | C++17 | 21 ms | 1884 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fileio(name) if (fopen(name".inp", "r")) freopen(name".inp", "r", stdin), freopen(name".out", "w", stdout)
const int maxn = 301, inf = 1e18;
int n, m, k, a[maxn], b[maxn], f[2][maxn*maxn];
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
fileio("");
// freopen("debug.txt", "w", stderr);
cin >> n >> m >> k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] < k) {
cout << "Impossible";
return 0;
}
}
for (int i = 1; i <= m; i++) {
cin >> b[i];
}
for (int i = 1; i <= 300*300; i++) {
f[0][i] = -inf;
}
for (int i = 1; i <= m; i++) {
for (int j = 0; j <= 300*300; j++) {
f[i%2][j] = f[(i-1)%2][j];
if (j >= b[i]) {
f[i%2][j] = max(f[i%2][j], f[(i-1)%2][j - b[i]] + min(n, b[i]));
}
}
}
int res = inf, sum = accumulate(a+1, a+1+n, 0LL);
for (int i = sum; i <= 300*300; i++) {
if (f[m%2][i] >= n*k) {
res = i;
break;
}
}
if (res < inf) {
cout << res - sum;
} else {
cout << "Impossible";
}
return 0 ^ 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
