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 n, m, k;
void fastIO()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main()
{
fastIO();
cin >> n >> m >> k;
int sumA = 0;
bool found = false;
for (int i = 1; i <= n; ++i)
{
int x;
cin >> x;
sumA += x;
if (x < k)
{
found = true;
}
}
int sumB = 0;
for (int i = 1; i <= m; ++i)
{
int x;
cin >> x;
sumB += x;
}
if (found == true || k > n || sumA > sumB || sumB < n * k)
{
cout << "Impossible" << endl;
}
else
{
cout << sumB - sumA << endl;
}
return 0;
}
# | 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... |