Submission #1839

# Submission time Handle Problem Language Result Execution time Memory
1839 2013-07-18T03:40:07 Z alephnull 점 모으기 (KOI13_collect) C++
24 / 24
50 ms 1592 KB
#include <cstdio> 
#include <algorithm> 
using namespace std; 
int main(){ 
    int n,m; 
    scanf("%d %d",&n,&m); 
    int x[m],y[m]; 
    for(int i=0;i<m;i++) 
        scanf("%d %d",x+i,y+i); 
    sort(x,x+m); 
    sort(y,y+m); 
    int xm=x[m/2],ym=y[m/2]; 
    int sumx=0,sumy=0; 
    for(int i=0;i<m;i++){ 
        sumx+=abs(xm-x[i]); 
        sumy+=abs(ym-y[i]); 
    } 
    printf("%d",sumx+sumy); 
} 
# Verdict Execution time Memory Grader output
1 Correct 0 ms 884 KB Output is correct
2 Correct 0 ms 884 KB Output is correct
3 Correct 0 ms 884 KB Output is correct
4 Correct 0 ms 884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 884 KB Output is correct
2 Correct 0 ms 884 KB Output is correct
3 Correct 0 ms 884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 888 KB Output is correct
2 Correct 9 ms 968 KB Output is correct
3 Correct 2 ms 884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1040 KB Output is correct
2 Correct 20 ms 1120 KB Output is correct
3 Correct 15 ms 1040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 1200 KB Output is correct
2 Correct 27 ms 1280 KB Output is correct
3 Correct 32 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1516 KB Output is correct
2 Correct 44 ms 1516 KB Output is correct
3 Correct 33 ms 1508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 884 KB Output is correct
2 Correct 37 ms 1432 KB Output is correct
3 Correct 41 ms 1592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 1592 KB Output is correct
2 Correct 50 ms 1592 KB Output is correct
3 Correct 46 ms 1592 KB Output is correct