답안 #32224

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
32224 2017-10-05T00:45:53 Z dqhungdl Fireworks (APIO16_fireworks) C++14
7 / 100
3 ms 9048 KB
#include <bits/stdc++.h>
using namespace std;

typedef pair<int,int> ii;
int n,m;
vector<ii> g[300005];

bool cmp(ii x1,ii x2)
{
    return x1.second<x2.second;
}

void Sub1()
{
    sort(g[1].begin(),g[1].end(),cmp);
    int tmp=g[1][int(g[1].size())/2].second;
    int64_t res=0;
    for(int i=0;i<g[1].size();i++)
        res+=abs(g[1][i].second-tmp);
    cout<<res;
}

int main()
{
    cin>>n>>m;
    int u,w;
    for(int i=2;i<=n+m;i++)
    {
        cin>>u>>w;
        g[u].push_back(ii(i,w));
    }
    if(n==1)
        Sub1();
}

Compilation message

fireworks.cpp: In function 'void Sub1()':
fireworks.cpp:18:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<g[1].size();i++)
                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9048 KB Output is correct
2 Correct 0 ms 9048 KB Output is correct
3 Correct 3 ms 9048 KB Output is correct
4 Correct 3 ms 9048 KB Output is correct
5 Correct 0 ms 9048 KB Output is correct
6 Correct 0 ms 9048 KB Output is correct
7 Correct 3 ms 9048 KB Output is correct
8 Correct 0 ms 9048 KB Output is correct
9 Correct 3 ms 9048 KB Output is correct
10 Correct 0 ms 9048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 9048 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9048 KB Output is correct
2 Correct 0 ms 9048 KB Output is correct
3 Correct 3 ms 9048 KB Output is correct
4 Correct 3 ms 9048 KB Output is correct
5 Correct 0 ms 9048 KB Output is correct
6 Correct 0 ms 9048 KB Output is correct
7 Correct 3 ms 9048 KB Output is correct
8 Correct 0 ms 9048 KB Output is correct
9 Correct 3 ms 9048 KB Output is correct
10 Correct 0 ms 9048 KB Output is correct
11 Incorrect 0 ms 9048 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9048 KB Output is correct
2 Correct 0 ms 9048 KB Output is correct
3 Correct 3 ms 9048 KB Output is correct
4 Correct 3 ms 9048 KB Output is correct
5 Correct 0 ms 9048 KB Output is correct
6 Correct 0 ms 9048 KB Output is correct
7 Correct 3 ms 9048 KB Output is correct
8 Correct 0 ms 9048 KB Output is correct
9 Correct 3 ms 9048 KB Output is correct
10 Correct 0 ms 9048 KB Output is correct
11 Incorrect 0 ms 9048 KB Output isn't correct
12 Halted 0 ms 0 KB -