# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148008 | imsifile | Bulb Game (FXCUP4_bulb) | C++17 | 133 ms | 25508 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 "bulb.h"
using namespace std;
int N, dlr[303030][2], dcn, par[303030], sw[303030], qsc, cha, ch[2], valid=-1, lose[303030];
vector<int> L, R;
int lca(int a, int b){
if(a==-1) return b;
if(a==-2) return a;
while(a>=0){
if(dlr[a][0] <= dlr[b][0] && dlr[b][0] <= dlr[a][1]) break;
a=par[a];
}
return a;
}
void pre(int ix){
if(ix<0) return;
dlr[ix][0]=dcn++;
pre(L[ix]), pre(R[ix]);
dlr[ix][1]=dcn-1;
}
void dfs(int pv, int ix){
if(ix==-1) return;
if(ix==-2){
if(cha==0) valid=-2;
if(cha==1 && qsc) valid=lca(valid,pv), lose[ch[0]]=1;
if(cha==2) lose[ch[0]]=lose[ch[1]]=1;
return;
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... |