Submission #158768

#TimeUsernameProblemLanguageResultExecution timeMemory
158768InfiniteJestCipele (COCI18_cipele)C++14
90 / 90
169 ms2552 KiB
#include <iostream> #include <fstream> #include <vector> #include <queue> #include <algorithm> #include <math.h> #include <map> #include <set> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ifstream in("input.txt"); ofstream out("output.txt"); typedef long long ll; int n,m; int va[100001]; int vb[100001]; bool funz(int k){ int indp=0; for(int i=0;i<m;i++){ bool flag=0; for(int y=indp;y<n;y++){ if(abs(va[y]-vb[i])<=k){ flag=1; indp=y+1; break; } } if(!flag)return 0; } return 1; } int main(){ cin>>n>>m; for(int i=0;i<n;i++)cin>>va[i]; for(int i=0;i<m;i++)cin>>vb[i]; sort(va,va+n); sort(vb,vb+m); if(n<m){ swap(va,vb); swap(n,m); } int s=0; int d=1e9+4; int minn=1e9+4; while(s<=d){ int k=(s+d)/2; if(funz(k)){ minn=min(minn,k); d=k-1; } else{ s=k+1; } } cout<<minn; }
#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...