# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
282573 | AaronNaidu | Fireworks (APIO16_fireworks) | C++14 | 5 ms | 7424 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<pair<ll, ll> > graph[300001];
vector<ll> v;
ll n, m, p, c, totChange, totalCost;
int main() {
cin >> n >> m;
for (int i = 2; i < n+m+1; i++)
{
cin >> p >> c;
v.push_back(c);
}
sort(v.begin(), v.end());
totalCost = 0;
for (int i = 0; i < v.size(); i++)
{
totalCost += abs(v[i] - v[v.size()/2]);
}
cout << totalCost << "\n";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |