QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#917362 | #995. 桥 | amend | WA | 74ms | 18956kb | C++23 | 1.8kb | 2025-02-27 10:49:45 | 2025-02-27 10:49:46 |
Judging History
answer
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<ctime>
#include<cmath>
#include<cctype>
#include<bitset>
#include<vector>
#include<cstdio>
#include<random>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x3f3f3f3f
#define INF 1e9
#define LLINF 1e18
#define ll long long
#define ld long double
#define FILE1(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define FILE2(x) freopen(x".in","r",stdin),freopen(x".ans","w",stdout)
#define FILE3(x) freopen(x".in","r",stdin)
#define Mod 998244353
#define N 100005
#define M 500005
using namespace std;
int read(){
int x=0,f=1,ch=getchar();
for(;!isdigit(ch);ch=getchar()) f=(ch=='-')?-1:1;
for(;isdigit(ch);ch=getchar()) x=(x<<3)+(x<<1)+(ch^48);
return x*f;
}
int add(int x,int y){return x+y>=Mod?x+y-Mod:x+y;}
int del(int x,int y){return add(x,Mod-y);}
int mul(int x,int y){return ((ll)x*y)%Mod;}
void Add(int &x,int y){x=add(x,y);}
void Del(int &x,int y){x=del(x,y);}
void Mul(int &x,int y){x=mul(x,y);}
int n,m,head[N],tot=1;
int dfn[N],low[N],idx;
bool cut[N];
struct edge{int x,y;}E[M];
struct Edge{int to,nxt,id;}e[M<<1];
void add_edge(int x,int y,int i){
e[++tot].to=y;
e[tot].id=i;
e[tot].nxt=head[x];
head[x]=tot;
}
void tarjan(int x,int pree){
dfn[x]=low[x]=++idx;
for(int i=head[x];i;i=e[i].nxt){
if(i==(pree^1)) continue;
int y=e[i].to;
if(!dfn[y]){
tarjan(y,i);
low[x]=min(low[x],low[y]);
if(low[y]>dfn[x]) cut[e[i].id]=true;
}
else low[x]=min(low[x],dfn[y]);
}
}
int main(){
n=read(),m=read();
for(int i=1;i<=m;++i){
int x=read(),y=read();
add_edge(x,y,i);
add_edge(y,x,i);
E[i]=(edge){x,y};
}
for(int i=1;i<=n;++i) if(!dfn[i]) tarjan(i,0);
for(int i=1;i<=m;++i) if(cut[i]) printf("%d %d\n",E[i].x,E[i].y);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 74ms
memory: 18956kb
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:
21242 2692 3443 6209 22780 13125 991 17687 9286 6883 23795 13972 22557 18652 790 16808 16688 13779 18920 18105 22950 16771 933 10208 22568 14839 19722 16043 18150 1031 22268 11061 11900 22749 23582 22262 3481 21090 5204 18754 8120 24916 5969 16716 17183 13732 13553 1844 24307 7827 16354 2894 4245 72...
result:
wrong output format Extra information in the output file