# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
428266 | schse | Kitchen (BOI19_kitchen) | C++17 | 19 ms | 296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N, M, K;
cin >> N >> M >> K;
vector<int> recipes(N), chefs(M);
for (int &i : recipes)
cin >> i;
for (int &i : chefs)
cin >> i;
int totalwork = accumulate(recipes.begin(), recipes.end(), 0);
int mnovertme = INT32_MAX;
vector<bool> workable(totalwork);
workable[0] = true;
for (int chef : chefs)
{
for (int i = workable.size() - 1; i >= 0; i--)
{
if (workable[i] && i + chef < workable.size())
workable[i + chef] = true;
else if (workable[i])
mnovertme = min(mnovertme, i + chef - totalwork);
}
}
if (mnovertme == INT32_MAX || (M>1&&min(chefs[0], chefs[1]) < N))
cout << "Impossible\n";
else
cout << mnovertme;
}
컴파일 시 표준 에러 (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... |