Submission #16290

# Submission time Handle Problem Language Result Execution time Memory
16290 2015-08-20T01:18:55 Z khsoo01 점 모으기 (KOI13_collect) C++
24 / 24
42 ms 1864 KB
#include<cstdio>
#include<algorithm>
using namespace std;
int m,n,a[100005],b[100005],sum;

int main()
{
    int i;
    scanf("%d%d",&m,&n);
    for(i=0;i<n;i++) {
        scanf("%d",&a[i]);
        scanf("%d",&b[i]);
    }
    sort(a,a+n);
    sort(b,b+n);
    for(i=0;i<n;i++){
        sum+=abs(a[i]-a[n/2]);
        sum+=abs(b[i]-b[n/2]);
    }
    printf("%d",sum);
}
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1864 KB Output is correct
2 Correct 12 ms 1864 KB Output is correct
3 Correct 0 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1864 KB Output is correct
2 Correct 14 ms 1864 KB Output is correct
3 Correct 16 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1864 KB Output is correct
2 Correct 29 ms 1864 KB Output is correct
3 Correct 36 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 1864 KB Output is correct
2 Correct 36 ms 1864 KB Output is correct
3 Correct 26 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1864 KB Output is correct
2 Correct 24 ms 1864 KB Output is correct
3 Correct 38 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 1864 KB Output is correct
2 Correct 41 ms 1864 KB Output is correct
3 Correct 37 ms 1864 KB Output is correct