| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1359073 | hexopia | Kitchen (BOI19_kitchen) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0),cin.tie(0);
int n,m,k;cin>>n>>m>>k;
vector<int> a(n),b(m);
for(int i = 0 ; i<n ; ++i) cin>>a[i];
for(int i = 0 ; i<m ; ++i) cin>>b[i];
int sum = 0;
for(int i = 0 ; i<n ; ++i){
if(a[i] < k) {
sum += a[i];
cout << "Impossible";
return 0;
}
}
int cnt = 0,now = 0;
sort(b.rbegin(),b.rend());
for(int i = 0 ; i<m ; ++i) {
cnt++;
now += b[i];
if(now >= sum) break;
}
if(now < sum) {
cout << "Impossible";
return 0;
}
cnt = max(cnt,k);
if(cnt > m) {
cout << "Impossible";
return 0;
}
else cout << cnt;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
