Submission #651701

#TimeUsernameProblemLanguageResultExecution timeMemory
651701ktkeremCipele (COCI18_cipele)C++17
90 / 90
53 ms3788 KiB
#include<bits/stdc++.h> typedef long long ll; typedef std::pair<ll , ll> llll; typedef std::string str; #define all(a) a.begin() , a.end() std::vector<ll> ar , br; ll n , m; void solve(){ std::cin >> n >> m; ar.resize(n); br.resize(m); for(ll i = 0;n>i;i++){ std::cin >> ar[i]; } for(ll i = 0;m>i;i++){ std::cin >> br[i]; } if(n > m){ std::swap(n , m); std::swap(ar , br); } std::sort(all(ar)); std::sort(all(br)); ll l = 0 , r = 1e9; while(r > l){ ll md = (l + r)/2; ll i = n - 1, j = m - 1; while(i >= 0 && j >= 0){ if(llabs(ar[i] - br[j]) > md){ j--; } else{ i--;j--; } } //std::cout << l << " " << r << " " << md << std::endl; if(i != -1){ l = md + 1; } else{ r = md; } } std::cout << l << "\n"; } int main(){ std::ios_base::sync_with_stdio(false);std::cin.tie(NULL); ll t = 1; //std::cin >> t; while(t--){ solve(); } }
#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...