QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#128508#995. 桥zhouzizhe#WA 74ms17228kbC++14811b2023-07-21 07:45:222023-07-21 07:45:26

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-21 07:45:26]
  • 评测
  • 测评结果:WA
  • 用时:74ms
  • 内存:17228kb
  • [2023-07-21 07:45:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int n,m;
int nxt[1000005],to[1000005],head[100005],ecnt=1;
int U[500005],V[500005];
void adde(int x,int y){
	nxt[++ecnt]=head[x];
	to[ecnt]=y;
	head[x]=ecnt;
}

int dfn[100005],low[100005],del[100005],dcnt;

void dfs(int x,int j){
	dfn[x]=low[x]=++dcnt;
	for(int i=head[x];i;i=nxt[i]){
		int y=to[i];
		if(i>>1==j)continue;
		if(dfn[y]==0){
			dfs(y,i>>1);
			low[x]=min(low[x],low[y]);
			if(low[x]<low[y])
				del[i>>1]=1;
		}
		else low[x]=min(low[x],dfn[y]);
	}
}


int main(){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;++i){
		scanf("%d %d",&U[i],&V[i]);
		adde(U[i],V[i]);
		adde(V[i],U[i]);
	}
	for(int i=1;i<=n;++i)
		if(dfn[i]==0)dfs(i,-1);
	for(int i=1;i<=m;++i){
		if(del[i])
			printf("%d %d\n",U[i],V[i]);
	}
}

详细

Test #1:

score: 0
Wrong Answer
time: 74ms
memory: 17228kb

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:

15746 21828
7598 23457
14883 19221
12188 3230
7808 23367
15712 21101
9097 23569
13570 11745
11161 3044
2338 15749
22238 21813
23994 19103
19633 1848
19487 19696
6799 19592
23430 23243
13441 17744
8680 20647
17093 20931
14720 5233
13549 7442
19329 24552
2358 12803
20847 16712
11398 47
14007 16099
616...

result:

wrong output format Extra information in the output file