Submission #4123

# Submission time Handle Problem Language Result Execution time Memory
4123 2013-09-01T17:05:46 Z pichulia 점 모으기 (KOI13_collect) C++
24 / 24
36 ms 1868 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int n, m;
int x[100004];
int 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]);
	}
	sort(x,x+m);sort(y,y+m);
	for(i=0;i<m;i++)
	{
		p+=abs(x[i]-x[m/2]) + abs(y[i]-y[m/2]);
	}
	printf("%d",p);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1868 KB Output is correct
2 Correct 0 ms 1868 KB Output is correct
3 Correct 0 ms 1868 KB Output is correct
4 Correct 0 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1868 KB Output is correct
2 Correct 0 ms 1868 KB Output is correct
3 Correct 0 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1868 KB Output is correct
2 Correct 8 ms 1868 KB Output is correct
3 Correct 0 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1868 KB Output is correct
2 Correct 16 ms 1868 KB Output is correct
3 Correct 12 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1868 KB Output is correct
2 Correct 20 ms 1868 KB Output is correct
3 Correct 28 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 1868 KB Output is correct
2 Correct 36 ms 1868 KB Output is correct
3 Correct 24 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1868 KB Output is correct
2 Correct 28 ms 1868 KB Output is correct
3 Correct 28 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 1868 KB Output is correct
2 Correct 32 ms 1868 KB Output is correct
3 Correct 36 ms 1868 KB Output is correct