# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1168916 | PieArmy | Harbingers (CEOI09_harbingers) | C++20 | 96 ms | 28484 KiB |
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int n;
vector<pair<int,ll>>komsu[100023];
ll s[100023],v[100023];
int par[100023][17],dep[100023];
ll path[100023],ans[100023];
int find_par(int pos,int x){
for(int i=0;i<17;i++){
if((1<<i)&x){
pos=par[pos][i];
}
}
return pos;
}
void dfs(int pos,int root){
for(int i=1;i<17;i++){
par[pos][i]=par[par[pos][i-1]][i-1];
}
int las=find_par(pos,dep[pos]);
while(dep[pos]>1){
int cur=find_par(pos,dep[pos]-1);
if(ans[las]-path[las]*v[pos]>=ans[cur]-path[cur]*v[pos]){
las=cur;
dep[pos]--;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |