# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
892339 | 2023-12-25T08:11:41 Z | LittleFlowers__ | Cipele (COCI18_cipele) | C++17 | 32 ms | 2908 KB |
#include <bits/stdc++.h> using namespace std; int32_t main() { if (fopen("input.txt", "r")) { freopen("input.txt", "r", stdin); } cin.tie(0)->sync_with_stdio(0); int n, m; cin >> n >> m; vector<int> a(n), b(m); for (int &i : a) cin >> i; for (int &i : b) cin >> i; if (n > m) swap(n, m), swap(a, b); sort(a.begin(), a.end()); sort(b.begin(), b.end()); int le = 0, mi, ri = 1e9, answer; while (le <= ri) { mi = (le + ri) / 2; bool okay = true; int j = 0; for (int i = 0; i < a.size(); ++i) { while (j < b.size() && abs(a[i] - b[j]) > mi) j += 1; if (j == b.size()) { okay = false; break; } j += 1; } if (okay) answer = mi, ri = mi - 1; else le = mi + 1; } cout << answer << '\n'; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 2652 KB | Output is correct |
2 | Correct | 32 ms | 2896 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 2904 KB | Output is correct |
2 | Correct | 32 ms | 2908 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Correct | 2 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Output is correct |
2 | Correct | 2 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 2400 KB | Output is correct |
2 | Correct | 19 ms | 1884 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 2652 KB | Output is correct |
2 | Correct | 14 ms | 2136 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 2396 KB | Output is correct |
2 | Correct | 28 ms | 2660 KB | Output is correct |