Submission #100435

#TimeUsernameProblemLanguageResultExecution timeMemory
100435cveleCipele (COCI18_cipele)C++14
90 / 90
126 ms2988 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...