Submission #920343

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9203432024-02-02 13:22:47byunjaewooOne-Way Streets (CEOI17_oneway)C++17
0 / 100
147 ms262144 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int Nmax=100010;
int N, M, K, cnt, dfsn[Nmax], G[Nmax], ans[Nmax], Dep[Nmax], Par[20][Nmax], X[Nmax], Y[Nmax];
bool chk[Nmax];
vector<pair<int, int>> adj[Nmax], adj2[Nmax];
stack<pair<int, int>> S;
map<pair<int, int>, bool> mp;
int Find(int x) {return G[x]?(G[x]=Find(G[x])):x;}
void Union(int u, int v) {
u=Find(u), v=Find(v);
if(u!=v) G[u]=v;
}
int DFS(int curr, int prev) {
dfsn[curr]=++cnt;
int ret=cnt;
for(auto [next, w]:adj[curr]) if(next!=prev) {
if(dfsn[next]<dfsn[curr]) S.push({curr, next});
if(dfsn[next]) ret=min(ret, dfsn[next]);
else {
int tmp=DFS(next, curr);
ret=min(ret, tmp);
if(tmp>=dfsn[curr]) {
bool flag=false;
while(!S.empty() && S.top()!=make_pair(curr, next)) {
Union(S.top().first, S.top().second);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...