QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#793473#996. 割点atgcWA 3ms5752kbC++14779b2024-11-29 20:22:312024-11-29 20:22:31

Judging History

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

  • [2024-11-29 20:22:31]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:5752kb
  • [2024-11-29 20:22:31]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5+10;

int n,m;
struct{int nxt,v;}edge[maxn << 1];
int head[maxn],ec;
void add(int u,int v){edge[++ec]={head[u],ec},head[u]=ec;}
int dfn[maxn],low[maxn],dfc;
bool iscut[maxn];

void dfs(int u){
	dfn[u]=low[u]=++dfc;
	int sonc=0;
	for(int i=head[u];i;i=edge[i].nxt){
		int v=edge[i].v;
		if(!dfn[v]){
			++sonc;dfs(v);
			if(low[v]==dfn[v])iscut[u]=1;
			low[u]=min(low[u],low[v]);
		}else{
			low[u]=min(low[u],dfn[v]);
		}
	}
	if(u==1)iscut[u]=(sonc>1);
}

signed main() {
	ios::sync_with_stdio(0),cin.tie(0);
	cin>>n>>m;
	for(int i=1,u,v;i<=m;++i)cin>>u>>v,add(u,v),add(v,u);
	dfs(1);
	cout<<accumulate(iscut,end(iscut),0)<<'\n';
	for(int i=1;i<=n;++i)if(iscut[i])cout<<i<<' ';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 5752kb

input:

12783 21968
4933 7832
8238 2739
3628 7841
9169 6390
7850 8797
8120 8710
5306 9807
10166 2063
2666 5157
5015 4651
4790 12586
10366 7137
12440 7218
6330 3670
2735 8492
1968 2750
6237 1112
6578 9221
743 3820
7155 4583
2537 9747
11331 9916
4454 5631
2978 10340
5293 1803
4944 4296
11800 2742
7903 2018
10...

output:

3
1 673 5985 

result:

wrong answer 1st numbers differ - expected: '1440', found: '3'