# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472316 |
2021-09-13T11:36:12 Z |
Ahmed57 |
Cipele (COCI18_cipele) |
C++14 |
|
97 ms |
1868 KB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
vector<long long>arr(n),aee(m);
for(int i =0;i<n;i++){
cin>>arr[i];
}
for(int i = 0;i<m;i++){
cin>>aee[i];
}
sort(arr.begin(),arr.end());sort(aee.begin(),aee.end());
if(m>n){swap(arr,aee);swap(n,m);}
if(n==m){
long long sum = 0;
for(int i = 0;i<n;i++){
sum=max(sum,abs(arr[i]-aee[i]));
}
cout<<sum<<"\n";
}else if(n>m){
long long ans = 0;
int y = 0;
for(int i = 0;i<m;i++){
for(;y<(n-m)+i;y++){
if(y<(((n-m)+i)-1)&&abs(arr[y]-aee[i])<=abs(arr[y+1]-aee[i]))break;
}
ans=max(ans,abs(arr[y]-aee[i]));
y++;
}
cout<<ans<<"\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
1740 KB |
Output is correct |
2 |
Correct |
96 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
97 ms |
1868 KB |
Output is correct |
2 |
Correct |
96 ms |
1860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
83 ms |
1552 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
89 ms |
1676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
78 ms |
1516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |