QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#342099 | #995. 桥 | Unreality# | WA | 91ms | 22004kb | C++14 | 1.9kb | 2024-03-01 08:54:50 | 2024-03-01 08:54:51 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define _rep(i_,a_,b_) for(int i_ = (a_); i_ <= (b_); ++i_)
#define mid ((L+R) >> 1)
#define multiCase() int testCnt = in(); _rep(curCase,1,testCnt)
#ifdef ONLINE_JUDGE
#define debug(...) 0
#else
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#endif
using ll = long long;
using pii = pair<int,int>;
int in(void) { int x; scanf("%d", &x); return x; } ll inl(void) { ll x; scanf("%lld", &x); return x; }
void out(int x) { printf("%d ", x); } void outln(int x) { printf("%d\n", x); }
void out(ll x) { printf("%lld ", x); } void outln(ll x) { printf("%lld\n", x); }
template<typename T> void chkmax(T &a, const T &b) { a = max(a, b); }
template<typename T> void chkmin(T &a, const T &b) { a = min(a, b); }
const int kN = 100500;
struct Edge { int u, v; };
vector<Edge> E; vector<int> g[kN];
int dfn[kN], low[kN], dfs_clock, cut[kN];
void dfs(int u, int f) {
dfn[u] = low[u] = ++dfs_clock;
for(auto &v : g[u]) if(v != (f ^ 1)) {
if(!dfn[E[v].v]) {
dfs(E[v].v, v), chkmin(low[u], low[E[v].v]);
if(low[E[v].v] > dfn[u]) cut[v] = cut[v ^ 1] = 1;
} else chkmin(low[u], dfn[E[v].v]);
}
}
int main() {
int n = in(), m = in();
_rep(i,1,m) {
int u = in(), v = in();
E.push_back(Edge{u, v});
g[u].emplace_back(E.size() - 1);
E.push_back(Edge{v, u});
g[v].emplace_back(E.size() - 1);
}
dfs(1, -1);
for(int i = 0; i < E.size(); i += 2) if(cut[i]) out(E[i].u), outln(E[i].v);
return 0;
}
/*
a list of keywords
clear empty push_back pop_back push pop top front back
emplace_back emplace push_front pop_front insert erase
find count set reset bitset map vector string multiset
first second iterator prev next deque multimap reverse
sort begin end list modify query init check calc prime
putchar getchar puts scanf printf max min swap replace
make_pair make_tuple numeric_limits auto function null
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 91ms
memory: 22004kb
input:
24942 387166 12556 21443 22404 16376 11073 24296 1535 11968 23745 2818 5073 12731 22550 14761 24118 12008 22695 18979 15118 13639 2080 8721 692 22578 22581 15267 9278 4127 7457 21674 17693 23448 10949 23429 9700 6009 14140 5064 7742 15164 17336 1662 18903 9760 17645 19575 6540 11942 11 4937 15282 10...
output:
20801 21607 22854 14743 378 20150 1638 18756 24272 2931 23996 7563 5622 21604 21681 5841 7911 14224 12219 14690 15815 12064 22792 13077 22015 6918 12401 10685 21608 16099 5905 9170 17124 5493 24906 2448 19873 20251 19721 5215 13885 14101 2496 15725 23738 21682 10556 20559 6984 6086 20439 21921 3513 ...
result:
wrong output format Extra information in the output file