QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#472768#996. 割点Harry27182#WA 4ms6560kbC++14802b2024-07-11 19:13:022024-07-11 19:13:03

Judging History

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

  • [2024-07-11 19:13:03]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:6560kb
  • [2024-07-11 19:13:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int dfn[100005],low[100005],h[100005],tot,vis[500005],cnt=1,n,m,u,v;
struct node{int u,v;}g[500005];
struct edge{int v,nxt;}e[1000005];
void add(int u,int v){e[++cnt]={v,h[u]};h[u]=cnt;}
void tarjan(int u)
{
	dfn[u]=low[u]=++tot;
	for(int i=h[u];i;i=e[i].nxt)
	{
		int v=e[i].v;
		if(!dfn[v])
		{
			tarjan(v);
			low[u]=min(low[u],low[v]);
			if(low[v]>=dfn[u])vis[u]++;
		}
		else low[u]=min(low[u],dfn[v]);
	}
}
int main()
{
	cin.tie(0)->sync_with_stdio(0);
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>u>>v;
		add(u,v);add(v,u); 
	}
	for(int i=1;i<=n;i++)if(!dfn[i])tarjan(i),vis[i]--;
	int ans=0;
	for(int i=1;i<=n;i++)if(vis[i])ans++;
	cout<<ans<<'\n'; 
	for(int i=1;i<=n;i++)if(vis[i])cout<<i<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 4ms
memory: 6560kb

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:

1859
13
14
22
26
27
29
33
35
36
37
39
45
47
53
62
78
91
112
116
118
119
127
131
132
144
151
155
156
163
166
168
177
183
187
192
194
196
205
219
220
223
225
239
248
250
254
256
265
285
290
293
313
315
318
319
336
337
338
347
356
358
371
376
386
388
408
414
415
427
446
459
461
464
471
477
486
504
513
...

result:

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