QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#126011#996. 割点cp152#RE 0ms0kbC++14923b2023-07-18 09:01:032023-07-18 09:01:04

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-18 09:01:04]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-07-18 09:01:03]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m;
int u[500005],v[500005];
vector<pair<int,int> > to[100005];
int ans[500005],an;
int dfn[100005],low[100005];
void dfs(int nx,int fr)
{
	low[nx]=dfn[nx]=++dfn[0];
	bool b=0;
	int cnt=0;
	for(auto i:to[nx])
	{
		if(i.second==fr)	continue;
		if(dfn[i.first])	low[nx]=min(low[nx],dfn[i.first]);
		else
		{
		++cnt;
			dfs(i.first,i.second);
			low[nx]=min(low[nx],low[i.first]);
			if(low[i.first]>=dfn[nx])	b=1;
		}
	}
	if((b&&fr)||(cnt>=2&&!fr))	ans[++an]=nx;
}
int main()
{
	freopen("11.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		u[i]=x;
		v[i]=y;
		to[x].push_back({y,i});
		to[y].push_back({x,i});
	}
	for(int i=1;i<=n;i++)
	{
		if(!dfn[i])	dfs(i,0);
	}
	sort(ans+1,ans+an+1);
	cout<<an<<'\n';
	for(int i=1;i<=an;i++)
	{
		cout<<ans[i]<<' ';
	}
	return 0;
}

详细

Test #1:

score: 0
Dangerous Syscalls

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:


result: