Submission #3453

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
34532013-08-31 05:53:08wookayinCactus? Not cactus? (kriii1_C)C++98
1 / 1
64 ms14120 KiB
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int n,e;
vector<int> graph[100000];
int t[100000];
int m[100000];
int tcnt;
//1 if ok
int dfs(int nod, int par)
{
m[nod] = t[nod] = ++tcnt;
int cnt = 0;
for(int i = 0; i < graph[nod].size(); i++){
int next = graph[nod][i];
if (next == par) continue;
if (t[next] != 0 && t[next] < t[nod]) {
// back edge
m[nod] = min(m[nod], t[next]);
cnt++;
if (cnt >= 2)
return 0;
} else if (t[next] == 0) {
int res = dfs(next, nod);
m[nod] = min(m[nod], m[next]);
if (res == 0)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...