Submission #544644

#TimeUsernameProblemLanguageResultExecution timeMemory
544644pokmui9909점 모으기 (KOI13_collect)C++17
24 / 24
29 ms2928 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; ll N, M; ll X[100005]; ll Y[100005]; int main() { cin.tie(0) -> sync_with_stdio(false); cin >> N >> M; for(int i = 0; i < M; i++) { cin >> X[i] >> Y[i]; } sort(X, X + M); sort(Y, Y + M); ll x = X[M / 2], y = Y[M / 2]; ll ans = 0; for(int i = 0; i < M; i++) { ans += abs(x - X[i]); ans += abs(y - Y[i]); } cout << ans; }
#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...