# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3780 | imsifile | Cactus? Not cactus? (kriii1_C) | C++98 | 0 ms | 6296 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<stdio.h>
#include<stdlib.h>
int n, m, par[111111], lv[111111], go[111111];
int ecn, enp[222222], prv[222222], top[111111];
int scn, ix[111111], stk[111111], chk[111111];
int lst, dd[111111];
void edg(int s, int e){
enp[ecn]=e, prv[ecn]=top[s], top[s]=ecn++;
}
void dfs(int k){
int s, e;
stk[scn++]=k, par[k]=-1, chk[k]=lv[k]=go[k]=1;
dd[0]=k, lst++;
while(scn){
s=stk[scn-1];
if(ix[s]==-1){
scn--;
if(s!=k){
if(go[par[s]]>go[s])go[par[s]]=go[s];
}
continue;
}
e=enp[ix[s]], ix[s]=prv[ix[s]];
if(e==par[s])continue;
if(chk[e]){
if(lv[s]>go[s]){
puts("Not cactus");
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |