Submission #82280

#TimeUsernameProblemLanguageResultExecution timeMemory
82280MilkiCipele (COCI18_cipele)C++14
90 / 90
52 ms1404 KiB
#include<bits/stdc++.h> using namespace std; #define FOR(i, a, b) for(int i = a; i < b; ++i) #define REP(i, n) FOR(i, 0, n) #define _ << " " << #define sz(x) ((int) x.size()) #define pb(x) push_back(x) typedef long long ll; typedef pair<int, int> point; const int MAXN = 1e5 + 5; int n, m; int a[MAXN], b[MAXN]; bool check(int x){ int curr = 0; REP(i, m){ if(curr >= n) return false; while(abs(a[curr] - b[i]) > x && curr < n) curr ++; if(curr == n) return false; curr ++; } return true; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; REP(i, n) cin >> a[i]; REP(i, m) cin >> b[i]; sort(a, a + n); sort(b, b + m); if(n < m){ swap(a, b); swap(n, m); } int lo = 0, hi = 1e9; while(lo < hi){ int mid = (lo + hi) >> 1; if(check(mid)) hi = mid; else lo = mid + 1; } cout << lo; }
#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...