QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#481539#996. 割点wanglianda#WA 2ms5848kbC++141.0kb2024-07-17 08:28:122024-07-17 08:28:13

Judging History

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

  • [2024-07-17 08:28:13]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5848kb
  • [2024-07-17 08:28:12]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=2e4;
ll read(){
	ll S=0,F=1;char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-')F*=-1;
		ch=getchar();
	}while(isdigit(ch)){
		S=(S<<3)+(S<<1)+(ch^48);
		ch=getchar();
	}return S*F;
}ll n,m,u,v,dfn[N+10],low[N+10],cnt;
ll buc[N+10],ind[N+10];queue<ll >que;
vector<ll >to[N+10],vs;
void dfs(ll id,ll rt){
	low[id]=dfn[id]=++cnt;ll son=0,bk=0;
	for(ll i=0;i<to[id].size();i++){
		if(!dfn[to[id][i]]){
			dfs(to[id][i],id);son++;
			low[id]=min(low[id],low[to[id][i]]);
		}else low[id]=min(low[id],dfn[to[id][i]]);
		if(low[to[id][i]]>=dfn[id]&&!bk&&id!=rt)bk++,vs.push_back(id);
	}if(!bk&&rt==id&&son>1)vs.push_back(id);
	return;
}int main(){
	n=read();m=read();
	while(m--){
		u=read();v=read();
//		swap(u,v);
		to[u].push_back(v);to[v].push_back(u);
	}for(ll i=1;i<=n;i++)if(!dfn[i])dfs(i,i);
	sort(vs.begin(),vs.end());
	printf("%lld\n",vs.size());
	for(ll i=0;i<vs.size();i++)printf("%lld ",vs[i]);
	putchar('\n');return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 5848kb

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:

3083
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 239 244 248 250 254 256 261 262 265 284 285 290 2...

result:

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