QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#793476 | #996. 割点 | atgc | WA | 4ms | 6060kb | C++14 | 841b | 2024-11-29 20:23:38 | 2024-11-29 20:23:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5+10;
int n,m;
struct{int nxt,v;}edge[maxn << 1];
int head[maxn],ec;
void add(int u,int v){edge[++ec]={head[u],ec},head[u]=ec;}
int dfn[maxn],low[maxn],dfc;
bool iscut[maxn];
template<bool is_fir=0>
void dfs(int u){
dfn[u]=low[u]=++dfc;
int sonc=0;
for(int i=head[u];i;i=edge[i].nxt){
int v=edge[i].v;
if(!dfn[v]){
++sonc;dfs(v);
if(low[v]==dfn[v])iscut[u]=1;
low[u]=min(low[u],low[v]);
}else{
low[u]=min(low[u],dfn[v]);
}
}
if(is_fir)iscut[u]=(sonc>1);
}
signed main() {
ios::sync_with_stdio(0),cin.tie(0);
cin>>n>>m;
for(int i=1,u,v;i<=m;++i)cin>>u>>v,add(u,v),add(v,u);
for(int i=1;i<=n;++i)if(!dfn[i])dfs<1>(i);
cout<<accumulate(iscut,end(iscut),0)<<'\n';
for(int i=1;i<=n;++i)if(iscut[i])cout<<i<<' ';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 6060kb
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:
12295 1 2 3 4 5 6 7 8 10 11 12 13 15 16 17 18 19 20 21 22 25 26 27 28 29 31 32 33 34 35 37 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 ...
result:
wrong answer 1st numbers differ - expected: '1440', found: '12295'