# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
818861 |
2023-08-10T07:03:56 Z |
vjudge1 |
Cipele (COCI18_cipele) |
C++14 |
|
82 ms |
1920 KB |
//***ZeroCoolCorp***//
#include <bits/stdc++.h>
#define ld long double
#define int long long
#define ll long long
using namespace std;
const int mxn = 1e5 + 5;
const int inf = 1e18;
const int mod = 1e9 + 7;
const int mxm = 105;
const ld eps = 1e-10;
vector<int> A(mxn);
vector<int> B(mxn);
int n,m;
bool yes(int x){
int ptr = 0;
for (int i = 0; i < n; i++) {
if (abs(B[ptr] - A[i]) <= x) ptr++;
if (ptr == m)return true;
}
return ptr == m ;
}
void solve(){
cin>>n>>m;
int hi = 0;
for(int i = 0;i<n;i++){
cin>>A[i];
hi = max(hi, A[i]);
}
for(int i = 0;i<m;i++){
cin>>B[i];
hi = max(hi, B[i]);
}
if(n < m){
swap(A, B);
swap(n,m);
}
sort(A.begin(), A.begin() + n);
sort(B.begin(), B.begin() + m);
int lo = 0;
while(hi > lo){
int mid = (lo + hi)/2;
//cout<<lo<<" "<<mid<<" "<<hi<<": "<<yes(mid)<<endl;
if(yes(mid))hi = mid;
else lo = mid+1;
}
cout<<lo<<endl;
}
int32_t main(){
#ifdef ONLINE_JUDGE
ios::sync_with_stdio(false);
cin.tie(nullptrr);
#endif
int t = 1;
// cin>>t;
while(t--)solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
78 ms |
1876 KB |
Output is correct |
2 |
Correct |
78 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
76 ms |
1748 KB |
Output is correct |
2 |
Correct |
82 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1920 KB |
Output is correct |
2 |
Correct |
4 ms |
1880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1876 KB |
Output is correct |
2 |
Correct |
4 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1876 KB |
Output is correct |
2 |
Correct |
4 ms |
1880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1876 KB |
Output is correct |
2 |
Correct |
7 ms |
1880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1876 KB |
Output is correct |
2 |
Correct |
5 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
1876 KB |
Output is correct |
2 |
Correct |
44 ms |
1856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
1856 KB |
Output is correct |
2 |
Correct |
43 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
1856 KB |
Output is correct |
2 |
Correct |
68 ms |
1876 KB |
Output is correct |