Submission #1130350

#TimeUsernameProblemLanguageResultExecution timeMemory
1130350am_aadvikFireworks (APIO16_fireworks)C++20
7 / 100
0 ms328 KiB
#include <iostream> #include<vector> #include<string> #include<queue> #include<map> #include<set> #include<algorithm> #include<math.h> #define int long long const int inf = 1e17; const int maxn = 300005; const int mod = (int)1e9 + 7; using namespace std; int32_t main() { int n, m; cin >> n >> m; vector<int> a; for (int i = 1; i < (n + m); ++i) { int x, y; cin >> x >> y; a.push_back(y); } sort(a.begin(), a.end()); int ans = 0; for (auto x : a) ans += abs(x - a[a.size() / 2]); 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...