# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
779324 |
2023-07-11T10:28:32 Z |
vjudge1 |
Cipele (COCI18_cipele) |
C++17 |
|
36 ms |
4048 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
#define OYY 1000000005
#define mod 998244353
vector <int> v,t;
int n,m,mid,cev=OYY,tut;
bool stop=true;
inline bool yes(int x){
tut=0;
for(int i=0;i<m;i++){
if(tut==n){
return true;
}
if(abs(t[i]-v[tut])>x)continue;
if(abs(t[i]-v[tut])<=x)tut++;
}
if(tut==n)return true;
else return false;
}
int32_t main(){
faster
cin>>n>>m;
int deg;
for(int i=0;i<n;i++){
cin>>deg;
v.push_back(deg);
}
for(int i=0;i<m;i++){
cin>>deg;
t.push_back(deg);
}
sort(v.begin(),v.end());
sort(t.begin(),t.end());
if(n==m){
int maxi=0;
for(int i=0;i<n;i++){
maxi=max(maxi,abs(v[i]-t[i]));
}
cout<<maxi<<'\n';
return 0;
}
if(m<n){
swap(n,m);
swap(v,t);
}
int l=0,r=1000000009;
while(l<=r){
mid=(l+r)/2;
if(yes(mid)){
r=mid-1;
cev=mid;
}
else l=mid+1;
}
cout<<cev<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
2640 KB |
Output is correct |
2 |
Correct |
30 ms |
2636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
2604 KB |
Output is correct |
2 |
Correct |
31 ms |
2556 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
428 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
2324 KB |
Output is correct |
2 |
Correct |
21 ms |
2528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
2424 KB |
Output is correct |
2 |
Correct |
16 ms |
3088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
2388 KB |
Output is correct |
2 |
Correct |
29 ms |
4048 KB |
Output is correct |