# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
145291 |
2019-08-19T14:09:03 Z |
Fasho |
Cipele (COCI18_cipele) |
C++14 |
|
85 ms |
3760 KB |
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("kmp.in","r",stdin);freopen ("kmp.out","w",stdout);
#define mod 1000000009
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
#define INF 1000000000005
using namespace std;
ll n,m,ar[N],sum,b[N];
bool check(ll x)
{
ll l=1;
for(int i=1;i<=n;i++)
{
while(fabs(ar[i]-b[l])>x && l<=m)
l++;
if(l>m || fabs(b[l]-ar[i])>x)
return 0;
}
return 1;
}
int main()
{
fast;
cin>>n>>m;
fs(ar,n);
fs(b,m);
sort(ar+1,ar+n+1);
sort(b+1,b+m+1);
if(m<n)
{
fo(i,1,n)
swap(ar[i],b[i]);
swap(n,m);
}
if(n==m)
{
fo(i,1,n)
sum=max(sum,abs(ar[i]-b[i]));
return cout<<sum,0;
}
ll l=0,r=max(ar[n],b[m])-min(ar[1],b[1]);
while(l<r)
{
if(l==r-1)
{
if(check(l))
r=l;
break;
}
ll mid=(l+r)/2;
if(check(mid))
r=mid;
else
l=mid+1;
}
cout<<r<<endl;
}
/* cd onedrive\desktop\kod
cls
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
3504 KB |
Output is correct |
2 |
Correct |
47 ms |
3704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
3760 KB |
Output is correct |
2 |
Correct |
47 ms |
3704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
392 KB |
Output is correct |
2 |
Incorrect |
5 ms |
504 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
380 KB |
Output is correct |
2 |
Incorrect |
5 ms |
504 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
400 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
508 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
3124 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
85 ms |
3448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
68 ms |
3052 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |