Submission #558666

#TimeUsernameProblemLanguageResultExecution timeMemory
558666pokmui9909Fireworks (APIO16_fireworks)C++17
7 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; ll N, M; ll P[300005], C[300005]; int main(){ cin.tie(0) -> sync_with_stdio(false); cin >> N >> M; for(ll i = 1; i < N + M; i++){ cin >> P[i] >> C[i]; } sort(C + 1, C + N + M); ll r = 0, m = C[(N + M) / 2]; for(ll i = 1; i < N + M; i++){ r += abs(m - C[i]); } cout << r; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...