# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
439646 | haojiandan | Dungeons Game (IOI21_dungeons) | C++17 | 52 ms | 78864 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e18;
const int maxn=(4e5)+10;
int n,hd,tl,q[maxn],lg[maxn*2];
struct Tree {
int a[maxn],in[maxn];
ll w[maxn],dep[maxn],p[maxn]; bool cyc[maxn],vis[maxn];
vector<int> son[maxn];
int fa[maxn][20]; ll mn[maxn][20];
void dfs(int u) {
for (int v : son[u]) if (!cyc[v]) {
dep[v]=dep[u]+p[v]; dfs(v);
}
}
int cnt,L[maxn],R[maxn],tot,bel[maxn];
ll all[maxn],pre[maxn*2];
int rem[maxn*2],st[maxn*2][21],pos[maxn];
ll query(int l,int r) {
int j=lg[r-l+1];
return min(st[l][j],st[r-(1<<j)+1][j]);
}
void build() {
for (int i=1;i<=n;i++) in[a[i]]++,son[a[i]].push_back(i),fa[i][0]=a[i];
//for (int i=1;i<=n;i++) printf("a[%d]=%d,w[%d]=%lld,p[%d]=%lld\n",i,a[i],i,w[i],i,p[i]);
hd=1,tl=0;
for (int i=1;i<=n;i++) if (!in[i]) q[++tl]=i;
while (hd<=tl) {
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |