QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#629453#996. 割点lngsctrerWA 4ms5380kbC++141005b2024-10-11 11:52:392024-10-11 11:52:40

Judging History

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

  • [2024-10-11 11:52:40]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:5380kb
  • [2024-10-11 11:52:39]
  • 提交

answer

#include<bits/stdc++.h>
using i64 = long long;
const int N = 20005, M = 1e5 + 10;
int read(){
	int x = 0, f = 1, c = getchar();
	while(!isdigit(c)){
		if(c == '-') f = -1;
		c = getchar();
	}
	while(isdigit(c)){
		x = x * 10 + (c ^ 48);
		c = getchar();
	}
	return x * f;
}
int n, m, dfn[N], dfncnt, low[N], vis[N], brid[N];
std::vector<int> E[N];
void dfs(int x, int f){
	vis[x] = 1;
	low[x] = dfn[x] = ++ dfncnt;
	int cnt = 0;
	for(auto i: E[x]){
		if(i == f) continue;
		if(!vis[i]){
			dfs(i, x);
			low[x] = std::min(low[x], low[i]);
		}else low[x] = std::min(low[x], dfn[i]);
		if(low[i] >= dfn[x]) cnt ++;
	}
	if(x == 1 && cnt >= 2) brid[x] = 1;
	if(x != 1 && cnt) brid[x] = 1;
}
void solve(){
	n = read(), m = read();
	for(int i = 1; i <= m; i ++){
		int x = read(), y = read();
		E[x].push_back(y), E[y].push_back(x);
	}
	dfs(1, 1);
	for(int i = 1; i <= n; i ++){
		if(brid[i]) std::cout << i << '\n';
	}
}
signed main(){
	solve();
	return 0;
}



Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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:

1
7
8
10
11
13
22
26
27
29
32
33
34
35
37
39
42
45
47
50
51
53
62
66
70
73
78
90
91
102
106
118
121
126
127
128
132
134
144
145
146
151
155
156
157
163
166
168
176
177
182
183
186
187
192
194
196
198
200
202
205
206
210
215
219
220
223
225
230
236
244
248
250
254
256
261
262
265
284
285
290
296
299
...

result:

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