답안 #282573

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
282573 2020-08-24T15:09:10 Z AaronNaidu Fireworks (APIO16_fireworks) C++14
7 / 100
5 ms 7424 KB
#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

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++)
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7296 KB Output is correct
2 Correct 5 ms 7296 KB Output is correct
3 Correct 5 ms 7424 KB Output is correct
4 Correct 5 ms 7424 KB Output is correct
5 Correct 5 ms 7424 KB Output is correct
6 Correct 5 ms 7296 KB Output is correct
7 Correct 5 ms 7424 KB Output is correct
8 Correct 5 ms 7296 KB Output is correct
9 Correct 5 ms 7424 KB Output is correct
10 Correct 5 ms 7424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 7424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7296 KB Output is correct
2 Correct 5 ms 7296 KB Output is correct
3 Correct 5 ms 7424 KB Output is correct
4 Correct 5 ms 7424 KB Output is correct
5 Correct 5 ms 7424 KB Output is correct
6 Correct 5 ms 7296 KB Output is correct
7 Correct 5 ms 7424 KB Output is correct
8 Correct 5 ms 7296 KB Output is correct
9 Correct 5 ms 7424 KB Output is correct
10 Correct 5 ms 7424 KB Output is correct
11 Incorrect 5 ms 7424 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7296 KB Output is correct
2 Correct 5 ms 7296 KB Output is correct
3 Correct 5 ms 7424 KB Output is correct
4 Correct 5 ms 7424 KB Output is correct
5 Correct 5 ms 7424 KB Output is correct
6 Correct 5 ms 7296 KB Output is correct
7 Correct 5 ms 7424 KB Output is correct
8 Correct 5 ms 7296 KB Output is correct
9 Correct 5 ms 7424 KB Output is correct
10 Correct 5 ms 7424 KB Output is correct
11 Incorrect 5 ms 7424 KB Output isn't correct
12 Halted 0 ms 0 KB -