# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
245902 |
2020-07-07T17:48:10 Z |
alrad |
Cipele (COCI18_cipele) |
C++17 |
|
58 ms |
3072 KB |
#include <bits/stdc++.h>
using namespace std;
#define N (int)1e9 + 1
#define all(x) x.begin(), x.end()
int main() {
#ifdef judge
ifstream cin("input.txt");
//ofstream cout("output.txt");
#endif // judge
ios_base :: sync_with_stdio(0);
cin.tie(0) , cout.tie(0);
int n , m;
cin >> n >> m;
vector<int> a(n) , b(m);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < m; i++) {
cin >> b[i];
}
sort(all(a)) , sort(all(b));
if (n > m) {
swap(n , m);
swap(a , b);
}
auto can = [&](int x) {
bool ok = true;
int j = 0;
for (int i = 0; i < n; i++) {
while (j < m && abs(a[i] - b[j]) > x) {
j++;
}
if (j >= m) {
ok = false;
break;
}
j++;
}
return ok;
};
int l = 0 , r = N;
while (l != r) {
int mid = (l + r) >> 1;
if (can(mid))
r = mid;
else
l = mid + 1;
}
cout << r << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
2680 KB |
Output is correct |
2 |
Correct |
53 ms |
2944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
3072 KB |
Output is correct |
2 |
Correct |
54 ms |
2936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
2432 KB |
Output is correct |
2 |
Correct |
35 ms |
1768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
2680 KB |
Output is correct |
2 |
Correct |
33 ms |
2040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
2432 KB |
Output is correct |
2 |
Correct |
47 ms |
2560 KB |
Output is correct |