#include <bits/stdc++.h>
// #define MULTI_TEST_CASE
// #define TEST_TEXT
using namespace std;
#define ll long long
#define MAX(a, b) (a) = max((a), (b))
#define MIN(a, b) (a) = min((a), (b))
#define all(a) (a).begin(), (a).end()
#define sortedpair(a, b) {min((a), (b)), max((a), (b))}
const ll MOD = 1e9+7;
#define IMPOSSIBLE {cout<<"Impossible"<<endl;return 0;}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int n, m, k; cin>>n>>m>>k;
vector<int> a(n);
int s = 0;
for(int&i:a){cin>>i;s += i;}
vector<int> b(m);
int sb = 0;
for(int&i:b){cin>>i;sb += i;}
if(k > m) IMPOSSIBLE
for(int i : a){
if(i < k) IMPOSSIBLE;
}
if(s > sb) IMPOSSIBLE;
if(m == 1){
cout<<sb - s<<endl;
return 0;
}
if(b[0] < n || b[1] < n)IMPOSSIBLE
cout<<b[0]+b[1]-s<<endl;
return 0;
}
# |
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 |
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 |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |