Submission #197861

#TimeUsernameProblemLanguageResultExecution timeMemory
197861Osama_AlkhodairyCipele (COCI18_cipele)C++17
72 / 90
53 ms2840 KiB
#include <bits/stdc++.h> using namespace std; #define finish(x) return cout << x << endl, 0 #define ll long long int n, m; vector <int> a, b; bool check(int x){ int pt = 0; for(auto &i : a){ while(pt < m && b[pt] < i - x) pt++; if(pt == m) return 0; if(b[pt] - i > x) return 0; pt++; } return 1; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m; a.resize(n); for(auto &i : a) cin >> i; b.resize(m); for(auto &i : b) cin >> i; if(b.size() < a.size()) swap(a, b); sort(a.begin(), a.end()); sort(b.begin(), b.end()); int l = 0, r = 1e9; while(l <= r){ int mid = (l + r) / 2; if(check(mid)) r = mid - 1; else l = mid + 1; } cout << l << endl; }
#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...