Submission #165688

#TimeUsernameProblemLanguageResultExecution timeMemory
165688handlenameCipele (COCI18_cipele)C++17
90 / 90
56 ms3068 KiB
#include <bits/stdc++.h> using namespace std; int n,m; int arr[100001]; int brr[100001]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>n>>m; for (int i=0;i<n;i++) cin>>arr[i]; for (int i=0;i<m;i++) cin>>brr[i]; sort(arr,arr+n); sort(brr,brr+m); int mini=-1,maxi=1000000000; while (mini+1<maxi){ int middle=(mini+maxi)/2; int apos=0,bpos=0,taken=0; while (apos<n && bpos<m){ if (abs(arr[apos]-brr[bpos])<=middle){ apos++; bpos++; taken++; } else if (arr[apos]<brr[bpos]) apos++; else bpos++; } if (taken==min(m,n)) maxi=middle; else mini=middle; } cout<<maxi; }
#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...