# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097758 | vjudge1 | The Xana coup (BOI21_xanadu) | C++17 | 34 ms | 17812 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<iostream>
#include<cstdio>
#include<bitset>
using namespace std;
const int N=1e5+10,inf=0x3f3f3f3f;
int cnt,hd[N],to[N<<1],nxt[N<<1];
void add(int u,int v){
++cnt;
to[cnt]=v;
nxt[cnt]=hd[u];
hd[u]=cnt;
}
bitset<N>aa,used;
int f[N][2][2],g[N][2][2];
void dfs(int p){
bool ju=1;
int pre=0;
used[p]=1;
for(int i=hd[p];i;i=nxt[i]){
if(used[to[i]])continue;
ju=0;
dfs(to[i]);
g[to[i]][0][0]=min(min(g[pre][0][0]+f[to[i]][0][0],inf),min(g[pre][0][1]+f[to[i]][1][0],inf));
g[to[i]][0][1]=min(min(g[pre][0][1]+f[to[i]][0][0],inf),min(g[pre][0][0]+f[to[i]][1][0],inf));
g[to[i]][1][0]=min(min(g[pre][1][0]+f[to[i]][0][1],inf),min(g[pre][1][1]+f[to[i]][1][1],inf));
g[to[i]][1][1]=min(min(g[pre][1][1]+f[to[i]][0][1],inf),min(g[pre][1][0]+f[to[i]][1][1],inf));
pre=to[i];
}
if(ju){
f[p][0][0]=(aa[p]?inf:0);
Compilation message (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |