Submission #781023

#TimeUsernameProblemLanguageResultExecution timeMemory
781023ymmCipele (COCI18_cipele)C++17
90 / 90
33 ms3676 KiB
#include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x) #define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x) typedef long long ll; typedef std::pair<int, int> pii; typedef std::pair<ll , ll > pll; using namespace std; int main() { cin.tie(0) -> sync_with_stdio(false); int n, m; cin >> n >> m; vector<ll> a(n), b(m); Loop (i,0,n) cin >> a[i]; Loop (i,0,m) cin >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (n > m) { swap(a, b); swap(n, m); } ll l = 0, r = 2e9; while (l < r) { ll mid = (l+r)/2; int p = 0; bool ok = 1; Loop (i,0,n) { while (p < m && abs(a[i] - b[p]) > mid) ++p; if (p == m) { ok = 0; break; } ++p; } if (ok) r = mid; else l = mid+1; } cout << l << '\n'; }
#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...