# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
100435 |
2019-03-11T09:54:36 Z |
cvele |
Cipele (COCI18_cipele) |
C++14 |
|
126 ms |
2988 KB |
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
using namespace std;
const int N = 100005;
int n, m;
vector <int> a, b;
bool ok(int x) {
int r = 0;
for (int i = 0; i < n; i++) {
while (r < m && abs(a[i] - b[r]) > x) r++;
if (r >= m) return 0;
r++;
}
return 1;
}
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
a.push_back(x);
}
for (int i = 0; i < m; i++) {
int x;
cin >> x;
b.push_back(x);
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
if (b.size() < a.size()) {
swap(a, b);
swap(n, m);
}
int l = 0, r = 2e9;
while (l < r) {
int mid = (l + r) >> 1;
if (ok(mid)) {
r = mid;
} else {
l = mid + 1;
}
}
cout << l << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
1936 KB |
Output is correct |
2 |
Correct |
126 ms |
1828 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
110 ms |
1820 KB |
Output is correct |
2 |
Correct |
109 ms |
1844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
10 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
10 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
11 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
1744 KB |
Output is correct |
2 |
Correct |
57 ms |
2032 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
1776 KB |
Output is correct |
2 |
Correct |
110 ms |
2288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
1748 KB |
Output is correct |
2 |
Correct |
87 ms |
2988 KB |
Output is correct |