QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#91388#995. 桥zsj6315#WA 13ms12260kbC++11930b2023-03-28 19:31:362023-03-28 19:31:38

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-28 19:31:38]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:12260kb
  • [2023-03-28 19:31:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define ull unsigned long long
#define ll long long
#define mod 998244353
#define N 100005
#define M 1000005
int n,m,uu[N],vv[N];
int edt=1,head[N],to[M],nx[M],ew[M];
int dfn[N],low[N],dc;
int tmp[M],tk;
void adde(int u,int v,int w){
	to[++edt]=v,nx[edt]=head[u],ew[edt]=w,head[u]=edt;
}
void tarjan(int u,int eds){
	dfn[u]=low[u]=++dc;
	for(int ed=head[u];ed;ed=nx[ed]){
		int v=to[ed];
		if((ed^eds)==1)continue; 
		if(!dfn[v]){
			tarjan(v,ed);
			low[u]=min(low[u],low[v]);
			if(low[v]>dfn[u])tmp[++tk]=ew[ed];
		}
		else low[u]=min(low[u],dfn[v]);
	}
}
int main(){
	scanf("%d%d",&n,&m);
	fr(i,1,m){
		scanf("%d%d",&uu[i],&vv[i]);
		adde(uu[i],vv[i],i);
		adde(vv[i],uu[i],i);
	}
	fr(i,1,n)if(!dfn[i])tarjan(i,0);
	sort(tmp+1,tmp+tk+1);
	fr(i,1,tk)printf("%d %d\n",uu[tmp[i]],vv[tmp[i]]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 13ms
memory: 12260kb

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:

23086 9796
11649 13969
15710 11305
17825 4536
24043 4070
11329 8017
11641 11818
23345 12685
975 14740
11747 13836
1074 21620
20267 8205
22847 10889
9139 22269
1699 12538
13455 4023
20163 19675
9864 22577
5976 23604
6840 10630
19614 5659
5066 5266
17235 21229
10257 10601
14125 10693
22861 24765
972 2...

result:

wrong output format Extra information in the output file