Submission #447464

# Submission time Handle Problem Language Result Execution time Memory
447464 2021-07-26T12:39:46 Z snasibov05 Fireworks (APIO16_fireworks) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, m; cin >> n >> m;
    vector<int> p(m), c(m);
    for (int i = 0; i < m; ++i) cin >> p[i] >> c[i];

    sort(c.begin(), c.end());
    long long ans = 0;
    for (int i = 0; i < m; ++i) {
        ans += abs(c[i] - c[m/2]);
    }
    cout << ans << "\n";

    return 0;
}

Compilation message

fireworks.cpp: In function 'int main()':
fireworks.cpp:11:5: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   11 |     sort(c.begin(), c.end());
      |     ^~~~
      |     qsort