답안 #661145

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
661145 2022-11-24T16:53:11 Z activedeltorre Fireworks (APIO16_fireworks) C++14
7 / 100
1 ms 300 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;
vector<int>vec;
int main()
{
    long long val,n,i,j,k,x,m;
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        cin>>x>>val;
        vec.push_back(val);
    }
    sort(vec.begin(),vec.end());
    long long mij=vec[m/2];
    long long suma=0;
    for(i=0;i<vec.size();i++)
    {
        suma=suma+max(mij-vec[i],vec[i]-mij);
    }
    cout<<suma;
    return 0;
}

Compilation message

fireworks.cpp: In function 'int main()':
fireworks.cpp:20:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(i=0;i<vec.size();i++)
      |             ~^~~~~~~~~~~
fireworks.cpp:10:23: warning: unused variable 'j' [-Wunused-variable]
   10 |     long long val,n,i,j,k,x,m;
      |                       ^
fireworks.cpp:10:25: warning: unused variable 'k' [-Wunused-variable]
   10 |     long long val,n,i,j,k,x,m;
      |                         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Incorrect 1 ms 300 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Incorrect 1 ms 300 KB Output isn't correct
12 Halted 0 ms 0 KB -