Submission #7734

# Submission time Handle Problem Language Result Execution time Memory
7734 2014-08-17T05:23:20 Z gs14004 점 모으기 (KOI13_collect) C++
24 / 24
36 ms 1868 KB
#include <cstdio>
#include <algorithm>
#include <cstdlib>
int x[100000],y[100000];
int main(){
    int m,n;
    scanf("%d %d",&m,&n);
    for (int i=0; i<n; i++) {
        scanf("%d %d",&x[i],&y[i]);
    }
    std::sort(x,x+n);
    std::sort(y,y+n);
    int px=x[n/2],py=y[n/2],res=0;
    for (int i=0; i<n; i++) {
        res+=abs(px-x[i])+abs(py-y[i]);
    }
    printf("%d",res);
}
# 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 4 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1868 KB Output is correct
2 Correct 8 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 16 ms 1868 KB Output is correct
3 Correct 28 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1868 KB Output is correct
2 Correct 28 ms 1868 KB Output is correct
3 Correct 20 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 24 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 28 ms 1868 KB Output is correct