# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
164229 |
2019-11-18T17:36:31 Z |
Nashik |
Cipele (COCI18_cipele) |
C++14 |
|
165 ms |
1144 KB |
#include <iostream>
#include <algorithm>
using namespace std;
int v1[100005],v2[100005],n,m,sol=-1;
void cb(int st,int dr){
if(st>dr)
return;
int mid=(st+dr)/2;
int point=1;
for(int i=1;i<=n;i++){
while(abs(v1[i]-v2[point])>mid){
point++;
if(point==m+1){
cb(mid+1,dr);
return;
}
}
point++;
}
sol=mid;
cb(st,mid-1);
}
int main()
{
cin>>n>>m;
if(n>m){
for(int i=1;i<=n;i++){
cin>>v2[i];
}
for(int i=1;i<=m;i++){
cin>>v1[i];
}
swap(n,m);
}
else{
for(int i=1;i<=n;i++){
cin>>v1[i];
}
for(int i=1;i<=m;i++)
cin>>v2[i];
}
sort(v1+1,v1+n+1);
sort(v2+1,v2+m+1);
cb(0,1000000005);
if(sol==-1)
while(1){
}
cout<<sol;
return 0;
}
/*
4 3
2 39 41 45
39 42 46
2 3
2 3
1 2 3
5 5
7 6 1 2 10
9 11 6 3 12
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
136 ms |
1144 KB |
Output is correct |
2 |
Correct |
165 ms |
1144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
165 ms |
1016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
10 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
18 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
376 KB |
Output is correct |
2 |
Correct |
10 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
376 KB |
Output is correct |
2 |
Correct |
11 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
1088 KB |
Output is correct |
2 |
Correct |
96 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
151 ms |
1016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
138 ms |
936 KB |
Output is correct |
2 |
Incorrect |
141 ms |
1000 KB |
Output isn't correct |