#include<cstdio>
#include<algorithm>
#define abs(x) ((x)<0?-(x):(x))
int a[100000];
int b[100000];
int main()
{
int i,n,res=0;
scanf("%*d%d",&n);
for(i=0;i<n;i++)scanf("%d%d",&a[i],&b[i]);
std::sort(a,a+n);
std::sort(b,b+n);
for(i=0;i<n;i++)res+=abs(a[n/2]-a[i])+abs(b[n/2]-b[i]);
printf("%d",res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1668 KB |
Output is correct |
2 |
Correct |
0 ms |
1668 KB |
Output is correct |
3 |
Correct |
0 ms |
1668 KB |
Output is correct |
4 |
Correct |
0 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1668 KB |
Output is correct |
2 |
Correct |
0 ms |
1668 KB |
Output is correct |
3 |
Correct |
0 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1668 KB |
Output is correct |
2 |
Correct |
6 ms |
1668 KB |
Output is correct |
3 |
Correct |
3 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
1668 KB |
Output is correct |
2 |
Correct |
16 ms |
1668 KB |
Output is correct |
3 |
Correct |
12 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
1668 KB |
Output is correct |
2 |
Correct |
23 ms |
1668 KB |
Output is correct |
3 |
Correct |
28 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
1668 KB |
Output is correct |
2 |
Correct |
37 ms |
1668 KB |
Output is correct |
3 |
Correct |
27 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1668 KB |
Output is correct |
2 |
Correct |
32 ms |
1668 KB |
Output is correct |
3 |
Correct |
32 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
1668 KB |
Output is correct |
2 |
Correct |
37 ms |
1668 KB |
Output is correct |
3 |
Correct |
36 ms |
1668 KB |
Output is correct |