# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745977 | 2023-05-21T10:18:41 Z | vjudge1 | Kitchen (BOI19_kitchen) | C++17 | 1 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n, m,k; cin>>n>>m>>k; int osszar=0; priority_queue<int> ar; vector<int> sef; for (int i=0; i<n;i++){ int a; cin>>a; osszar+=a; ar.push(a); } for (int i=0; i<m;i++){ int x; cin>>x; sef.push_back(x); } sort(sef.begin(), sef.end(), greater<int>() ); int ans=0; int armost=ar.top(); for (int i=0; i<m;i++){ while (sef[i]>0 && !ar.empty()){ if (sef[i]<=armost){ armost-=sef[i]; if (armost==0 && !ar.empty()){ ar.pop(); armost=ar.top(); } sef[i]=0; } else{ sef[i]-=armost; ar.pop(); if (!ar.empty())armost=ar.top(); } } if (ar.empty()){ cout<<sef[i]; return 0; } } cout<<"IMPOSSIBLE"<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |