# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
555408 |
2022-04-30T21:01:56 Z |
hidden1 |
Pipes (CEOI15_pipes) |
C++14 |
|
967 ms |
65536 KB |
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#ifndef LOCAL
#define cerr if(false) cerr
#endif
#define endl "\n"
#define out(x) "[" << #x << "=" << x << "]"
struct debug {
debug() { cerr << "DEBUGGER: " << endl; }
~debug() { cerr << endl << "DEBUGGER_END " << endl; }
template<class T>
debug& operator <<(const T x) {
cerr << x << " ";
return *this;
}
};
template<class T> inline ostream &operator <<(ostream &out, const vector<T> &x) {
for(const auto &it : x) {
out << it << " ";
}
return out;
}
template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) {
return out << x.first << " " << x.second;
}
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
typedef long long ll;
const ll mod = 1e9 + 7;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
const int MAX_N = 1e5 + 10;
vector<pair<int, int> > g[MAX_N];
int low[MAX_N], in[MAX_N], tme = 0;
int n, m;
void dfs(int x, int ind) {
in[x] = low[x] = ++ tme;
for(auto it : g[x]) {
if(low[it.first] == 0) {
dfs(it.first, it.second);
chkmin(low[x], low[it.first]);
if(low[it.first] > in[x]) {
cout << x << " " << it.first << endl;
}
} else if(it.second != ind) {
chkmin(low[x], in[it.first]);
}
}
}
signed main() {
#ifndef LOCAL
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#endif
cin >> n >> m;
for(int i = 0; i < m; i ++) {
int a, b;
cin >> a >> b;
g[a].push_back({b, i});
g[b].push_back({a, i});
}
for(int i = 1; i <= n; i ++) {
if(low[i] == 0) {
dfs(i, -1);
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3284 KB |
Output is correct |
2 |
Correct |
5 ms |
3156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
118 ms |
23944 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
202 ms |
34236 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
382 ms |
60752 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
650 ms |
65536 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
833 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
966 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
967 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
900 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |