# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
16589 | gs14004 | Cactus? Not cactus? (kriii1_C) | C++14 | 72 ms | 11180 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 <cstdio>
#include <vector>
using namespace std;
bool ret = true;
bool colp[100005], vis[100005];
int par[100005];
vector<int> graph[100005];
void dfs(int x, int pa){
vis[x] = 1;
par[x] = pa;
for(auto &i : graph[x]){
if(i == pa) continue;
if(!vis[i]) continue;
int pos = x;
while(1){
if(colp[pos]){
ret = 0;
break;
}
colp[pos] = 1;
if(pos == i) break;
pos = par[pos];
}
}
for(auto &i : graph[x]){
if(i == pa) continue;
if(vis[i]) continue;
dfs(i, x);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |