# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
745960 | 2023-05-21T10:06:43 Z | vjudge1 | Kitchen (BOI19_kitchen) | C++17 | 1000 ms | 300 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long int; const ll mod = 1e9 + 7; ll f(vector<ll>& t, vector<ll>& v, int k){ vector<pair<ll, int>> p; for(auto i : v){ p.push_back({i, 0}); } for(auto& i : t){ for(int j = 0; j < p.size(); ++j){ if(i > 0 && p[j].second < k){ //mindehol legalabb k chef --i; --p[j].first; ++p[j].second; } } } ll sumv = 0, sumt = 0; for(int j = 0; j < p.size(); ++j){ if(p[j].second < k){ return 1e9; } sumv += p[j].first; } for(auto& i : t){ sumt += i; } if(sumt - sumv < 0) return 1e9; return sumt - sumv; } int main(){ int n, m, k; cin >> n >> m >> k; vector<ll> v(n), t(m); ll sumv = 0; for(auto& i : v){ cin >> i; } for(auto& i : t){ cin >> i; } if(m < k || *min_element(begin(v), end(v)) < k){ cout << "Impossible" << endl; return 0; } ll sol = 1e9; for(ll i = 0; i < (1ll << m); ++i){ vector<ll> munkas; for(int j = 0; j < m; ++j){ if((1ll << j) & i){ munkas.push_back(t[j]); } } sol = min(sol, f(munkas, v, k)); } if(sol == 1e9){ cout << "Impossible" << endl; } else{ cout << sol << endl; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 300 KB | Output is correct |
3 | Correct | 1 ms | 296 KB | Output is correct |
4 | Correct | 1 ms | 296 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 300 KB | Output is correct |
3 | Correct | 1 ms | 296 KB | Output is correct |
4 | Correct | 1 ms | 296 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 14 ms | 212 KB | Output is correct |
10 | Correct | 11 ms | 300 KB | Output is correct |
11 | Correct | 22 ms | 284 KB | Output is correct |
12 | Correct | 35 ms | 280 KB | Output is correct |
13 | Incorrect | 284 ms | 212 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1055 ms | 276 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 300 KB | Output is correct |
3 | Correct | 1 ms | 296 KB | Output is correct |
4 | Correct | 1 ms | 296 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 14 ms | 212 KB | Output is correct |
10 | Correct | 11 ms | 300 KB | Output is correct |
11 | Correct | 22 ms | 284 KB | Output is correct |
12 | Correct | 35 ms | 280 KB | Output is correct |
13 | Incorrect | 284 ms | 212 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |