Submission #4150

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
41502013-09-02 12:42:54pys7293Cactus? Not cactus? (kriii1_C)C++98
1 / 1
76 ms15104 KiB
#include <algorithm>
#include <cstdio>
#include <map>
#include <memory.h>
#include <vector>
using namespace std;
int N, M;
int Lv[111111], C;
int Lo[111111];
int Chk[111111];
int P[111111];
vector<vector<int> > L;
void DFS(int i, int PP)
{
if (Lv[i] == 0) Lv[i] = Lo[i] = ++C;
for (int j = 0; j < L[i].size(); j++) {
if (PP == L[i][j]) continue;
if (Lv[L[i][j]] == 0) {
P[L[i][j]] = i;
DFS(L[i][j], i);
Lo[i] = min(Lo[i], Lo[L[i][j]]);
if (Lv[i] < Lo[L[i][j]]) Chk[L[i][j]] = true;
} else Lo[i] = min(Lo[i], Lv[L[i][j]]);
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...