#include<stdio.h>
#include<algorithm>
int n, m;
int x[100004],y[100005];
int p;
int main()
{
int i, j;
scanf("%d %d",&n,&m);
for(i=0; i<m; i++)scanf("%d %d",&x[i],&y[i]);
std::sort(x,x+m);std::sort(y,y+m);
for(i=0;i<m;i++)p+=std::abs(x[i]-x[m/2]) + std::abs(y[i]-y[m/2]);
printf("%d",p);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
4 ms |
1864 KB |
Output is correct |
2 |
Correct |
9 ms |
1864 KB |
Output is correct |
3 |
Correct |
0 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
1864 KB |
Output is correct |
2 |
Correct |
16 ms |
1864 KB |
Output is correct |
3 |
Correct |
13 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
1864 KB |
Output is correct |
2 |
Correct |
24 ms |
1864 KB |
Output is correct |
3 |
Correct |
29 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
1864 KB |
Output is correct |
2 |
Correct |
39 ms |
1864 KB |
Output is correct |
3 |
Correct |
25 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1864 KB |
Output is correct |
2 |
Correct |
35 ms |
1864 KB |
Output is correct |
3 |
Correct |
33 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1864 KB |
Output is correct |
2 |
Correct |
41 ms |
1864 KB |
Output is correct |
3 |
Correct |
39 ms |
1864 KB |
Output is correct |