# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472326 |
2021-09-13T11:46:56 Z |
Ahmed57 |
Cipele (COCI18_cipele) |
C++14 |
|
1000 ms |
1864 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);}
map<int,int> mp;
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{
long long ans = 0;
int y = 0;
for(int i = 0;i<m;i++){
long long f = 1e18;
for(int j = 0;j<n;j++){
if(f>abs(arr[j]-aee[i])&&mp[j]!=1){
f = abs(arr[j]-aee[i]);
mp[j] = 1;
}
}
ans = max(ans,f);
}
cout<<ans<<"\n";
}
return 0;
}
Compilation message
cipele.cpp: In function 'int main()':
cipele.cpp:27:13: warning: unused variable 'y' [-Wunused-variable]
27 | int y = 0;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
106 ms |
1740 KB |
Output is correct |
2 |
Correct |
99 ms |
1848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
107 ms |
1848 KB |
Output is correct |
2 |
Correct |
103 ms |
1848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
119 ms |
412 KB |
Output is correct |
2 |
Correct |
632 ms |
576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
528 KB |
Output is correct |
2 |
Correct |
619 ms |
532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
416 ms |
568 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
400 ms |
560 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
507 ms |
536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
1864 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
1856 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1095 ms |
1572 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |