This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
int sum = 0;
for (auto &x : a) {
cin >> x; sum += x;
}
for (auto &x : b) cin >> x;
bitset<90001> dp(1);
for (auto x : b) dp |= (dp << x);
for (int i = sum; i < 90001; i++) {
if (dp[i]) {
cout << i - sum;
return 0;
}
}
cout << "Impossible\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |