# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
86676 |
2018-11-27T05:48:25 Z |
dimash241 |
Pipes (CEOI15_pipes) |
C++17 |
|
748 ms |
36624 KB |
# include <stdio.h>
# include <bits/stdc++.h>
#define Accepted 0
#define pb push_back
#define F first
#define S second
#define For(i,x,y) for (int i = x; i <= y; i ++)
#define FOr(i,x,y) for (int i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
using namespace std;
int n, m;
bitset < 10101 > g[10101];
bitset < 10101 > has[10101];
bitset < 10101 > was[10101];
vector < pair < int, int > > ans;
int tin[10101];
int fup[10101];
bool u[10101];
int timer;
inline void dfs (int v, int par) {
tin[v] = fup[v] = ++ timer;
for (int i = g[v]._Find_first(); i < g[v].size(); i = g[v]._Find_next(i)) {
if (i == par) continue;
if (tin[i]) {
fup[v] = min(fup[v], tin[i]);
} else {
dfs (i, v);
fup[v] = min(fup[v], fup[i]);
if (tin[v] < fup[i]) {
if(has[v][i]) continue;
ans.pb({min(v, i), max(v, i)});
}
}
}
}
int main () {
cin >> n >> m;
For (i, 1, m) {
int l, r;
cin >> l >> r;
if (was[l][r]) {
has[l][r] = 1;
has[r][l] = 1;
}
was[l][r] = 1;
was[r][l] = 1;
g[l][r] = 1;
g[r][l] = 1;
}
For (i, 1, n) {
if (!tin[i]) {
dfs (i, i);
}
}
for (auto it : ans)
cout << it.F << ' ' << it.S << '\n';
return Accepted;
}
Compilation message
pipes.cpp: In function 'void dfs(int, int)':
pipes.cpp:27:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = g[v]._Find_first(); i < g[v].size(); i = g[v]._Find_next(i)) {
~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
640 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
11904 KB |
Output is correct |
2 |
Correct |
20 ms |
11648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
386 ms |
13784 KB |
Output is correct |
2 |
Correct |
391 ms |
12848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
748 ms |
36624 KB |
Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
384 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 |
512 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 |
428 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 |
512 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 |
512 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 |
484 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |