# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
98956 | SecretAgent007 | Cipele (COCI18_cipele) | C++17 | 72 ms | 3284 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1e18
vector<int> a;
vector<int> b;
bool check(int x){
int p = 1;
for(int i = 1; i < a.size(); i++){
while(p < b.size() && abs(b[p]-a[i]) > x){
p++;
}
if(p >= b.size()) return false;
p++;
}
return true;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
a.resize(n+1);
b.resize(m+1);
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int i = 1; i <= m; i++){
cin >> b[i];
}
sort(a.begin()+1, a.end());
sort(b.begin()+1, b.end());
if(n > m){
swap(a,b);
swap(n,m);
}
int l = 0; int r = INF;
while(l < r){
int mid = (l+r)>>1;
if(check(mid)){
r = mid;
}else{
l = mid+1;
}
}
cout << l << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |