# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
567225 | 2022-05-23T09:30:10 Z | Dodo | Kitchen (BOI19_kitchen) | C++14 | 1 ms | 212 KB |
#include <bits/stdc++.h> #define ll long long #define endl '\n' #define pb push_back using namespace std; const ll mx=1007, INF=1e18L+5; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,m,k; cin>>n>>m>>k; ll sum=0; for(int i=0;i<n;i++) { ll x; cin>>x; sum+=x; } vector<ll>v(m); for(int i=0;i<m;i++)cin>>v[i]; for(ll bm=0;bm<=(1<<m);bm++) { ll su=0; for(int i=0;i<m;i++) { if(bm&(1<<i)) { su+=v[i]; } } if(su>=sum)v.push_back(su); } sort(v.begin(),v.end()); ll u=lower_bound(v.begin(),v.end(),sum)-v.begin(); if(u!=v.size()) { cout<<v[u]-sum; } else cout<<"Impossible"; return 0; } /* 3 3 1 3 3 2 3 3 3 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | 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 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |