Submission #282573

#TimeUsernameProblemLanguageResultExecution timeMemory
282573AaronNaiduFireworks (APIO16_fireworks)C++14
7 / 100
5 ms7424 KiB
#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)

fireworks.cpp: In function 'int main()':
fireworks.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i = 0; i < v.size(); i++)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...