#include<cstdio>
#include<algorithm>
using namespace std;
int m,n,a[100005],b[100005],sum;
int main()
{
int i;
scanf("%d%d",&m,&n);
for(i=0;i<n;i++) {
scanf("%d",&a[i]);
scanf("%d",&b[i]);
}
sort(a,a+n);
sort(b,b+n);
for(i=0;i<n;i++){
sum+=abs(a[i]-a[n/2]);
sum+=abs(b[i]-b[n/2]);
}
printf("%d",sum);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1864 KB |
Output is correct |
2 |
Correct |
0 ms |
1864 KB |
Output is correct |
3 |
Correct |
0 ms |
1864 KB |
Output is correct |
4 |
Correct |
0 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1864 KB |
Output is correct |
2 |
Correct |
0 ms |
1864 KB |
Output is correct |
3 |
Correct |
0 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
1864 KB |
Output is correct |
2 |
Correct |
12 ms |
1864 KB |
Output is correct |
3 |
Correct |
0 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
1864 KB |
Output is correct |
2 |
Correct |
14 ms |
1864 KB |
Output is correct |
3 |
Correct |
16 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1864 KB |
Output is correct |
2 |
Correct |
29 ms |
1864 KB |
Output is correct |
3 |
Correct |
36 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
1864 KB |
Output is correct |
2 |
Correct |
36 ms |
1864 KB |
Output is correct |
3 |
Correct |
26 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1864 KB |
Output is correct |
2 |
Correct |
24 ms |
1864 KB |
Output is correct |
3 |
Correct |
38 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
1864 KB |
Output is correct |
2 |
Correct |
41 ms |
1864 KB |
Output is correct |
3 |
Correct |
37 ms |
1864 KB |
Output is correct |