Submission #558664

#TimeUsernameProblemLanguageResultExecution timeMemory
558664pokmui9909Fireworks (APIO16_fireworks)C++17
0 / 100
0 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 + 1); ll r = 0, m = C[(N + M + 1) / 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...