# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472279 |
2021-09-13T11:02:15 Z |
Ahmed57 |
Cipele (COCI18_cipele) |
C++14 |
|
103 ms |
1068 KB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
vector<int>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){
int sum = 0;
for(int i = 0;i<n;i++){
sum+=abs(arr[i]-aee[i]);
}
cout<<sum<<"\n";
}else if(n>m){
int 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+=abs(arr[y]-aee[i]);
y++;
}
cout<<ans<<"\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
89 ms |
1068 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
103 ms |
1060 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
82 ms |
924 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
97 ms |
976 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
87 ms |
900 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |