Submission #86711

# Submission time Handle Problem Language Result Execution time Memory
86711 2018-11-27T07:16:05 Z I_use_Brute_force Pipes (CEOI15_pipes) C++14
10 / 100
322 ms 16604 KB
 #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 time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Incorrect 2 ms 612 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1152 KB Output is correct
2 Incorrect 6 ms 868 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 142 ms 8684 KB Output is correct
2 Correct 139 ms 8072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 274 ms 12184 KB Output is correct
2 Runtime error 322 ms 16604 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -