QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#126003#996. 割点cp152#WA 0ms10968kbC++14851b2023-07-18 08:50:122023-07-18 08:50:15

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 08:50:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:10968kb
  • [2023-07-18 08:50:12]
  • 提交

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;
	for(auto i:to[nx])
	{
		if(i.second==fr)	continue;
		if(dfn[i.first])	low[nx]=min(low[nx],dfn[i.first]);
		else
		{
			dfs(i.first,i.second);
			low[nx]=min(low[nx],low[i.first]);
			if(low[i.first]>=dfn[nx])	b=1;
		}
	}
	if(b&&fr)	ans[++an]=nx;
}
int main()
{
	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
Wrong Answer
time: 0ms
memory: 10968kb

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:

1438
13 22 26 27 29 33 35 37 39 45 47 53 62 78 91 118 127 132 144 151 155 156 163 166 168 177 183 187 192 194 196 205 219 220 223 225 248 250 254 256 265 285 290 313 315 337 338 347 356 358 376 386 388 408 414 415 427 446 459 461 464 477 486 504 513 519 538 555 557 571 574 608 611 619 625 626 633 63...

result:

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