QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#479851 | #996. 割点 | liuhangxin# | WA | 4ms | 6948kb | C++14 | 1.2kb | 2024-07-15 21:14:14 | 2024-07-15 21:14:14 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const int N=1e5+10,M=5e5+10;
int n,m;
int h[N],e[2*M],ne[2*M],idx;
pii bg[M];
int dfn[N],low[N],tot;
inline void add(int a,int b)
{
e[idx]=b;
ne[idx]=h[a];
h[a]=idx++;
}
vector<int>ans;
bool vis[N];
inline void dfs(int u,int from)
{
dfn[u]=low[u]=++tot;
int cnt=0;
for(int i=h[u];i!=-1;i=ne[i]){
if((i^1)==from)continue;
int v=e[i];
if(!dfn[v])
{
dfs(v,i);
low[u]=min(low[u],low[v]);
if(low[v]>=dfn[u])cnt++,vis[u]=1;
}
else low[u]=min(low[u],dfn[v]);
}
// if(cnt+(from!=-1)>1)vis[u]=1;
}
int main()
{
memset(h,-1,sizeof h);
scanf("%d%d",&n,&m);
for(int i=1;i<=m;i++)
{
int a,b;
scanf("%d%d",&a,&b);
if(a==b)continue;
bg[i]={a,b};
add(a,b);
add(b,a);
}
for(int i=1;i<=n;i++)
if(!dfn[i])
dfs(i,-1);
int ans=0;
for(int i=1;i<=n;i++)
if(vis[i])ans++;
printf("%d\n",ans);
for(int i=1;i<=n;i++)
if(vis[i])
printf("%d ",i);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 6948kb
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:
1467 1 13 22 26 27 29 33 35 37 39 45 47 53 56 62 78 91 118 127 132 144 151 155 156 163 166 168 177 181 183 187 192 194 196 205 219 220 223 225 239 248 250 254 256 265 270 285 290 302 313 315 337 338 347 356 358 376 386 388 408 414 415 427 446 459 461 464 477 486 504 513 519 530 538 555 557 571 574 6...
result:
wrong answer 1st numbers differ - expected: '1440', found: '1467'