| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1332667 | ayaz | Cipele (COCI18_cipele) | C++20 | 29 ms | 1220 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algos/debug.h"
#else
#define debug(...) 42
#endif
#define all(x) (x).begin(), (x).end()
#define isz(x) (int)x.size()
const int INF = 1e18;
void run(int tc) {
int n, m;
cin >> n >> m;
vector<int> a(n + 1), b(m + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= m; i++) {
cin >> b[i];
}
if (n > m) {
a.swap(b);
swap(n, m);
}
sort(all(a));
sort(all(b));
debug(a, b);
int low = 0, high = INF, best = INF;
auto check = [&](int diff) -> bool {
int l = 1;
for (int i = 1; i <= n; i++) {
while (l <= m && abs(b[l] - a[i]) > diff) l++;
if (l > m) {
return false;
}
l++;
}
return true;
};
while (low <= high) {
int mid = (low + high) >> 1;
if (check(mid)) {
high = mid - 1;
best = mid;
} else {
low = mid + 1;
}
}
cout << best << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
for (int tc = 1; tc <= t; tc++) run(tc);
}Compilation message (stderr)
| # | 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... | ||||
| # | 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... | ||||
