제출 #175350

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1753502020-01-07 06:23:32onjo0127Fireworks (APIO16_fireworks)C++11
100 / 100
428 ms86452 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pil = pair<int, ll>;
ll zv[300009];
priority_queue<ll> pq[300009];
vector<pil> T[300009];
int sz[300009];
void dfs(int x) {
sz[x] = 1;
for(auto& it: T[x]) {
dfs(it.first);
sz[x] += sz[it.first];
}
sort(T[x].begin(), T[x].end(), [&](pil P, pil Q) { return sz[P.first] > sz[Q.first]; });
}
void go(int x, int p, ll pc) {
if(T[x].empty()) return;
int mxi = T[x][0].first;
for(auto& it: T[x]) go(it.first, p, it.second);
for(auto& it: T[x]) {
if(it.first == mxi) continue;
int t; ll c; tie(t, c) = it;
while(pq[t].size()) {
pq[mxi].push(pq[t].top());
pq[t].pop();
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

fireworks.cpp: In function 'int main()':
fireworks.cpp:46:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N, M; scanf("%d%d",&N,&M);
               ~~~~~^~~~~~~~~~~~~~
fireworks.cpp:48:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int p, c; scanf("%d%d",&p,&c);
                   ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...