This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int n, m, y[10001], x[10001], ans;
void input(void)
{
int i;
scanf("%d %d",&n,&m);
for(i=1 ; i<=n ; i++)
scanf("%d %d",&y[i],&x[i]);
sort(y+1,y+n+1);
sort(x+1,x+n+1);
}
void process(void)
{
int i;
for(i=1 ; i<=n ; i++)
ans+=abs(y[(n+1)/2]-y[i])+abs(x[(n+1)/2]-x[i]);
}
void output(void)
{
printf("%d",ans);
}
int main(void)
{
input();
process();
output();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |