# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
170358 |
2019-12-24T21:39:56 Z |
mdn2002 |
Cipele (COCI18_cipele) |
C++14 |
|
61 ms |
1144 KB |
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
int n,m,a[100005],b[100005];
bool ck(int x)
{
if(n>=m)
{
int j=0;
for(int i=0;i<n;i++)
{
int aa=max(a[i],b[j]);
int bb=min(a[i],b[j]);
if((n-i)<(m-j))return 0;
if(aa-bb<=x)j++;
if(j==m)break;
}
return 1;
}
else
{
int j=0;
for(int i=0;i<m;i++)
{
int aa=max(a[j],b[i]);
int bb=min(a[j],b[i]);
if((n-j)>(m-i))return 0;
if(aa-bb<=x)j++;
if(j==n)break;
}
return 1;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen("lemonade.in","r",stdin);
//freopen("lemonade.out","w",stdout);
cin>>n>>m;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<m;i++)cin>>b[i];
sort(a,a+n);
sort(b,b+m);
int l=0,r=1e9+20,mid;
while(l<r)
{
mid=(l+r)/2;
if(ck(mid))r=mid;
else l=mid+1;
}
cout<<l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
1144 KB |
Output is correct |
2 |
Correct |
61 ms |
1144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
1144 KB |
Output is correct |
2 |
Correct |
60 ms |
1144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Incorrect |
5 ms |
380 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
1024 KB |
Output is correct |
2 |
Correct |
35 ms |
832 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
54 ms |
1116 KB |
Output is correct |
2 |
Correct |
37 ms |
1064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
888 KB |
Output is correct |
2 |
Correct |
51 ms |
1084 KB |
Output is correct |