Submission #86711

#TimeUsernameProblemLanguageResultExecution timeMemory
86711I_use_Brute_forcePipes (CEOI15_pipes)C++14
10 / 100
322 ms16604 KiB
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define F first #define S second #define pii pair <int, int> #define sz(a) (int)(a.size()) #define resize(v) v.resize(unique(all(v)) - v.begin()); #define all(a) a.begin(), a.end() #define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++) using namespace std; void Fast_Read_Out() { ios_base::sync_with_stdio(0); cin.tie(), cout.tie(); } void Random() { unsigned int seed; asm("rdtsc" : "=A" (seed)); srand(seed); } unsigned int Time() { unsigned int time = clock() / 1000.00; return time; } const int inf = int(1e9) + 123; const int N = int(1e4) + 213; int fup[N], tin[N], timer, used[N]; vector <pair <int, int> > ans; vector <int> g[N]; void dfs(int v, int par = -1) { used[v] = 1; tin[v] = fup[v] = timer++; for(int i = 0; i < sz(g[v]); i++) { int to = g[v][i]; if(to == par) continue; if(used[to]) fup[v] = min(fup[v], tin[to]); else { dfs(to, v); fup[v] = min(fup[v], fup[to]); if(fup[to] > tin[v]) cout << v << ' ' << to << endl; } } } int main () { #ifdef JUDGE freopen("input.txt", "r", stdin); #endif Random(); Fast_Read_Out(); int n, m; cin >> n >> m; for(int i = 1; i <= m; i++) { int a, b; cin >> a >> b; g[a].pb(b); g[b].pb(a); } for(int i = 1; i <= n; i++) if(!used[i]) dfs(i); #ifdef JUDGE // cout << Time() << endl; #endif } // Easy Peasy Lemon Squeezy Sometimes it's the very people who no one imagines anything of who do the things no one can imagine.
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...