# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
726839 |
2023-04-19T12:13:23 Z |
TimDee |
Kitchen (BOI19_kitchen) |
C++17 |
|
82 ms |
724 KB |
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define forn(i,n) for(int i=0;i<n;++i)
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define f first
#define s second
#define pi pair<int,int>
#define vii(a,n) vector<int>a(n);forn(i,n)cin>>a[i];
void solve() {
int n,m,k; cin>>n>>m>>k;
if (k-1) exit(1);
vii(a,n);
vii(b,m);
vector<int> dp(1e5,0);
dp[0]=1;
int s=0; forn(i,n) s+=a[i];
for(auto&x:b) {
for (int i=9e4; i>=0; --i) {
dp[i+x]|=dp[i];
}
}
for (int i=s; i<1e5; ++i) {
if (dp[i]) {
cout<<i-s;
return;
}
}
cout<<"Impossible";
}
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
2 ms |
696 KB |
Output is correct |
3 |
Correct |
2 ms |
724 KB |
Output is correct |
4 |
Runtime error |
1 ms |
212 KB |
Execution failed because the return code was nonzero |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
2 ms |
696 KB |
Output is correct |
3 |
Correct |
2 ms |
724 KB |
Output is correct |
4 |
Runtime error |
1 ms |
212 KB |
Execution failed because the return code was nonzero |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
724 KB |
Output is correct |
2 |
Correct |
62 ms |
724 KB |
Output is correct |
3 |
Correct |
82 ms |
724 KB |
Output is correct |
4 |
Correct |
82 ms |
724 KB |
Output is correct |
5 |
Correct |
55 ms |
700 KB |
Output is correct |
6 |
Correct |
57 ms |
724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
212 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
2 ms |
696 KB |
Output is correct |
3 |
Correct |
2 ms |
724 KB |
Output is correct |
4 |
Runtime error |
1 ms |
212 KB |
Execution failed because the return code was nonzero |
5 |
Halted |
0 ms |
0 KB |
- |