# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
855712 |
2023-10-01T16:50:32 Z |
vjudge1 |
Cipele (COCI18_cipele) |
C++17 |
|
39 ms |
3336 KB |
#ifndef Local
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define lim 100000
using namespace std;
const int mod=1000000007ll;
void solve(){
int n,m;
cin>>n>>m;
vector<int> a(n),b(m);
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<m;i++){
cin>>b[i];
}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
if(m<n){
swap(n,m);
swap(a,b);
}
int l=0,r=1e9,ans=INT_MAX;
while(l<=r){
bool sure=1;
int mid=(l+r)/2;
int j=0;
//cerr<<mid<<"\n";
for(int i=0;i<min(n,m);i++,j++){
if(m<=j){sure=0;break;}
while(j<m&&mid<abs(a[i]-b[j])){
j++;
}
if(m<=j){sure=0;break;}
//cerr<<i<<" "<<j<<"\n";
}
//cerr<<sure<<"\n\n";
if(sure){
ans=mid;
r=mid-1;
}else{
l=mid+1;
}
}
cout<<ans<<"\n";
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
#ifdef Local
freopen("in","r",stdin);
freopen("out","w",stdout);
#endif
int t=1;
//cin>>t;
while (t--)
{
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
1884 KB |
Output is correct |
2 |
Correct |
35 ms |
1880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
1880 KB |
Output is correct |
2 |
Correct |
36 ms |
1884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
1752 KB |
Output is correct |
2 |
Correct |
23 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
1872 KB |
Output is correct |
2 |
Correct |
16 ms |
2500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
1628 KB |
Output is correct |
2 |
Correct |
31 ms |
3336 KB |
Output is correct |