# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3909 | BalloonCollector | Cactus? Not cactus? (kriii1_C) | C++98 | 72 ms | 12152 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;
typedef pair <int, int> ii;
int ch[100002], p[100002], c[100002], che[100002];
vector <ii> v[100002];
int cycle = 0;
void dfs(int u){
if( cycle ) return ;
ch[u] = 1;
int si = v[u].size();
// printf("%d\n", u);
for(int i=0; i<si; i++){
if( !che[v[u][i].second] ){
che[v[u][i].second] = 1;
if( !ch[v[u][i].first] ){
p[v[u][i].first] = u;
dfs( v[u][i].first );
}
else if( p[u] != v[u][i].first ){
int pos = u;
c[v[u][i].first] ++;
if( c[v[u][i].first] >= 2 ) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |