# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472195 |
2021-09-13T09:12:39 Z |
AbdoMo |
Cipele (COCI18_cipele) |
C++17 |
|
71 ms |
6472 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+m];
multiset<int>ms;
if(n<=m)
{
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
while(m--)
{
int x;
cin>>x;
ms.insert(x);
}
sort(arr,arr+n);
}
else
{
for(int i=0;i<n;i++)
{
int x;
cin>>x;
ms.insert(x);
}
for(int i=0;i<m;i++)
{
cin>>arr[i];
}
}
/*for(int i=0;i<n;i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;*/
int ans=0;
for(int i=0;i<min(n,m);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 |
Incorrect |
47 ms |
6472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
65 ms |
6448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Incorrect |
3 ms |
588 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
588 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
588 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
588 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
71 ms |
6060 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
6052 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
53 ms |
5756 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |