# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
756578 |
2023-06-12T00:35:28 Z |
pcc |
Cipele (COCI18_cipele) |
C++14 |
|
66 ms |
3456 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define fs first
#define sc second
const int mxn = 1e5+10;
int a[mxn],b[mxn];
int n,m;
bool f(ll k){
deque<int> dq;
for(int i = 0;i<m;i++)dq.push_back(b[i]);
for(int i = 0;i<n;i++){
while(!dq.empty()&&a[i]-dq.front()>k)dq.pop_front();
if(dq.empty())return false;
if(abs(a[i]-dq.front())>k)return false;
dq.pop_front();
}
return true;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>m;
for(int i = 0;i<n;i++){
cin>>a[i];
}
for(int i = 0;i<m;i++)cin>>b[i];
if(n>m){
swap(a,b);
swap(n,m);
}
sort(a,a+n);
sort(b,b+m);
int l = 0,r = 1e9+10;
while(l != r){
int mid = (l+r)>>1;
if(f(mid))r = mid;
else l = mid+1;
}
cout<<l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
3044 KB |
Output is correct |
2 |
Correct |
66 ms |
3408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
3456 KB |
Output is correct |
2 |
Correct |
55 ms |
3312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
2844 KB |
Output is correct |
2 |
Correct |
33 ms |
2360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
2996 KB |
Output is correct |
2 |
Correct |
32 ms |
2708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
2740 KB |
Output is correct |
2 |
Correct |
52 ms |
2964 KB |
Output is correct |