# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
254587 | maximath_1 | Fireworks (APIO16_fireworks) | C++11 | 305 ms | 70904 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct slop{
ll a, b;
priority_queue<ll>pq;
slop& operator+=(slop& x){
a+=x.a; b+=x.b;
if(x.pq.size()>pq.size())
swap(pq, x.pq);
for(;!x.pq.empty();x.pq.pop())
pq.push(x.pq.top());
return *this;
}
}f[300005];
ll cst[300005];
vector<int>adj[300005];
void dfs(int nw){
if(adj[nw].size()==0){ //leaf
f[nw].a=1; f[nw].b=-cst[nw];
f[nw].pq.push(cst[nw]);
f[nw].pq.push(cst[nw]);
return;
}
for(int nx:adj[nw]){
dfs(nx);
f[nw]+=f[nx];
}
//>1 useless, reduce
for(;f[nw].a>1;){
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |