QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#129517#995. 桥zyz07#RE 0ms0kbC++17927b2023-07-22 20:19:232023-07-22 20:19:27

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-22 20:19:27]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-07-22 20:19:23]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define For(Ti,Ta,Tb) for(auto Ti=(Ta);Ti<=(Tb);++Ti)
#define Dec(Ti,Ta,Tb) for(auto Ti=(Ta);Ti>=(Tb);--Ti)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define range(Tx) begin(Tx),end(Tx)
using ll=long long;
const int N=1e5+5,M=5e5+5;
int n,m,dfn[N],low[N],dfx,cut[N];
vector<pair<int,int>> g[N];
struct Edge{
	int u,v;
}edge[M];
void tarjan(int u,int pre){
	dfn[u]=low[u]=++dfx;
	for(auto [v,i]:g[u]) if(i!=pre){
		if(!dfn[v]){
			tarjan(v,i);
			low[u]=min(low[u],low[v]);
		}else{
			low[u]=min(low[u],dfn[v]);
		}
		if(low[v]>dfn[u]) cut[i]=1;
	}
}
int main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	cin>>n>>m;
	For(i,1,m){
		int u,v;
		cin>>u>>v;
		edge[i]={u,v};
		g[u].emplace_back(v,i);
		g[v].emplace_back(u,i);
	}
	For(i,1,n) if(!dfn[i]) tarjan(i,0);
	For(i,1,m) if(cut[i]) cout<<edge[i].u<<' '<<edge[i].v<<'\n';
	return 0;
}

詳細信息

Test #1:

score: 0
Runtime Error

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:

13175 22566
3443 6209
15136 5705
5774 8826
17960 9282
19771 6092
24196 349
15098 17190
21282 4468
20160 20204
2662 11211
8319 11717
88 22264
1373 8238
14235 14025
4522 6345
12585 21983
17377 20832
8899 13520
3605 6415
11609 4410
16288 19670
18587 19305
8382 1205
324 20518
8918 254
17902 22689
9735 7...

result: