Submission #779507

#TimeUsernameProblemLanguageResultExecution timeMemory
779507DangerNoodle7591Cipele (COCI18_cipele)C++17
90 / 90
44 ms3024 KiB
//#include<bits/stdc++.h> #include<iostream> #include<bitset> #include<algorithm> using namespace std; #define lalala ios_base::sync_with_stdio(false);cin.tie(NULL); #define endl "\n" #define pb push_back #define N 100005 bitset<N> var; int main(){ lalala; int n,m; vector<int> a,b;cin>>n>>m; for(int i=0;i<n;i++){ int aa;cin>>aa; a.pb(aa); } for(int i=0;i<m;i++){ int bb;cin>>bb; b.pb(bb); } sort(a.begin(),a.end()); sort(b.begin(),b.end()); if(n>m){ swap(n,m);swap(a,b); } int l=0,r=1000000000; while(l<=r){ int mid=(l+r)/2; int ok=0; for(int i=0;i<m;i++){ if(ok==n){ break; } if(abs(b[i]-a[ok])<=mid){ ok++; } } if(ok==n){ r=mid-1; } else l=mid+1; } cout<<l<<endl; }
#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...