Submission #5313

#TimeUsernameProblemLanguageResultExecution timeMemory
5313baneling100점 모으기 (KOI13_collect)C++98
4.80 / 24
4 ms1164 KiB
#include <stdio.h> #include <stdlib.h> #include <algorithm> using namespace std; int n, m, y[10001], x[10001], ans; void input(void) { int i; scanf("%d %d",&n,&m); for(i=1 ; i<=m ; i++) scanf("%d %d",&y[i],&x[i]); sort(y+1,y+m+1); sort(x+1,x+m+1); } void process(void) { int i; for(i=1 ; i<=m ; i++) ans+=abs(y[(m+1)/2]-y[i])+abs(x[(m+1)/2]-x[i]); } void output(void) { printf("%d",ans); } int main(void) { input(); process(); output(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...