# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384335 | 2021-04-01T12:10:24 Z | AdiZer0 | Cipele (COCI18_cipele) | C++17 | 69 ms | 2560 KB |
#include <bits/stdc++.h> #define pb push_back #define whole(x) x.begin(), x.end() #define sz(x) (int)x.size() using namespace std; typedef long long ll; typedef long double ld; const int N = (int)1e5 + 7; const int INF = (int)1e9 + 7; const ll linf = (ll)1e18 + 1; int n, m; int a[N], b[N]; bool ok(int mx) { int p = 1; for (int i = 1; i <= n; ++i) { while (p <= m && abs(a[i] - b[p]) > mx) ++p; if (abs(a[i] - b[p]) > mx) ++p; if (p > m) return false; ++p; } return true; } int main() { scanf ("%d %d", &n, &m); for (int i = 1; i <= n; ++i) scanf ("%d", a + i); for (int i = 1; i <= m; ++i) scanf ("%d", b + i); if (n > m) { for (int i = 1; i <= n; ++i) swap(a[i], b[i]); swap(n, m); } sort(a + 1, a + n + 1); sort(b + 1, b + m + 1); int l = 0, r = (int)1e9; while (r - l > 1) { int mid = l + r >> 1; if (ok(mid)) r = mid; else l = mid; } if (ok(l)) printf ("%d\n", l); else printf ("%d\n", r); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 36 ms | 2284 KB | Output is correct |
2 | Correct | 52 ms | 2540 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 56 ms | 2284 KB | Output is correct |
2 | Correct | 69 ms | 2560 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 492 KB | Output is correct |
2 | Correct | 4 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 3 ms | 620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 56 ms | 2156 KB | Output is correct |
2 | Correct | 31 ms | 1772 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 61 ms | 2156 KB | Output is correct |
2 | Correct | 27 ms | 2156 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 2156 KB | Output is correct |
2 | Correct | 46 ms | 2540 KB | Output is correct |