답안 #447464

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
447464 2021-07-26T12:39:46 Z snasibov05 Fireworks (APIO16_fireworks) C++14
컴파일 오류
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