QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#724765 | #9525. Welcome to Join the Online Meeting! | xydCatGirl# | WA | 2ms | 5744kb | C++20 | 1.2kb | 2024-11-08 14:59:24 | 2024-11-08 14:59:25 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define N 500005
#define endl "\n"
#define fi first
#define se second
using namespace std;
const ll mod=1e9+7;
const ll inf=1e18;
const double eps=1e-6;
ll n,m,k;
ll vis[N],fl[N],cnt[N];
vector<ll>v[N];
vector<ll>ans[N];
void dfs(ll x){
fl[x]=1;
if(vis[x])return ;
for(auto y:v[x]){
if(fl[y])continue;
ans[x].push_back(y);
dfs(y);
}
}
void dfs2(ll x){
fl[x]=1;
if(vis[x])return ;
cout<<x<<" "<<ans[x].size()<<" ";
for(auto y:ans[x])cout<<y<<" ";
cout<<endl;
for(auto y:v[x]){
if(fl[y])continue;
dfs2(y);
}
}
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
cin>>n>>m>>k;
for(int i=1;i<=k;i++){
ll x;
cin>>x;
vis[x]=1;
}
for(int i=1;i<=m;i++){
ll x,y;
cin>>x>>y;
v[x].push_back(y);
v[y].push_back(x);
}
for(int i=1;i<=n;i++)if(!vis[i]&&!fl[i])dfs(i);
for(int i=1;i<=n;i++){
if(!fl[i]){
cout<<"No\n";
return 0;
}
fl[i]=0;
}
cout<<"Yes\n";
for(int i=1;i<=n;i++)if(!vis[i]&&!fl[i])dfs2(i);
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 5744kb
input:
4 5 2 3 4 1 2 1 3 2 3 3 4 2 4
output:
Yes 1 1 2 2 2 3 4
result:
wrong answer on step #1, member 2 has been invited