# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472186 |
2021-09-13T09:07:35 Z |
AbdoMo |
Cipele (COCI18_cipele) |
C++17 |
|
81 ms |
5820 KB |
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define pb push_back
const int mod = 1e9+7;
using namespace std;
bool comp(pair<int,int>&a ,pair<int,int>&b)
{
if(a.first==b.first)
{
return a.second>b.second;
}
return a.first<b.first;
}
void solve()
{
int n,m;
cin>>n>>m;
int arr[n];
multiset<int>ms;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
while(m--)
{
int x;
cin>>x;
ms.insert(x);
}
sort(arr,arr+n);
/*for(int i=0;i<n;i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;*/
int ans=0;
for(int i=0;i<n;i++)
{
int x = arr[i];
auto it1=ms.upper_bound(x);
auto it2=ms.upper_bound(x);
if(it1!=ms.begin())
{
it1--;
}
if(it2!=ms.end())
{
if(abs(x-*it1)<=abs(x-*it2))
{
ans=max(ans,abs(x-*it1));
ms.erase(it1);
}
else
{
ans=max(ans,abs(x-*it2));
ms.erase(it2);
}
}
else
{
ans=max(ans,abs(x-*it1));
ms.erase(it1);
}
}
cout<<ans<<endl;
}
int32_t main(){
int t=1;
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//cin>>t;
while(t--){solve();}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
5692 KB |
Output is correct |
2 |
Incorrect |
81 ms |
5820 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
5728 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
71 ms |
5412 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
68 ms |
5224 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
62 ms |
5044 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |