답안 #1080

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080 2013-06-24T17:46:32 Z tncks0121 점 모으기 (KOI13_collect) C++
24 / 24
40 ms 1668 KB
#include <stdio.h>
#include <algorithm>
using namespace std;
const int M=100100;
int n,m,x[M],y[M],X,Y;
int s;
int main()
{
int i;
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);
X=x[m/2]; Y=y[m/2];
s=0;
for(i=0;i<m/2;++i)
s+=(X-x[i])+(Y-y[i]);
for(;i<m;++i)
s+=(x[i]-X)+(y[i]-Y);
printf("%d\n",s);
return 0;
}
# 결과 실행 시간 메모리 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 3 ms 1668 KB Output is correct
2 Correct 7 ms 1668 KB Output is correct
3 Correct 1 ms 1668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1668 KB Output is correct
2 Correct 16 ms 1668 KB Output is correct
3 Correct 11 ms 1668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 1668 KB Output is correct
2 Correct 20 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 34 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 37 ms 1668 KB Output is correct
2 Correct 40 ms 1668 KB Output is correct
3 Correct 38 ms 1668 KB Output is correct