QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#717868 | #9525. Welcome to Join the Online Meeting! | 20225954# | WA | 2ms | 6580kb | C++20 | 1.6kb | 2024-11-06 19:08:57 | 2024-11-06 19:09:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2e5+10;
int flag[maxn],busy[maxn];
queue<int> q;
vector<int> v[maxn];
vector<int> ans[maxn];
vector<int> u;
void solve(){
int n,m,k;
cin>>n>>m>>k;
memset(flag,0,sizeof(flag));
memset(busy,0,sizeof(busy));
for(int i=1;i<=k;i++){
int num;
cin>>num;
busy[num]=1;
}
for(int i=1;i<=m;i++){
int a,b;
cin>>a>>b;
v[a].push_back(b);
v[b].push_back(a);
}
int fa=0;
if(n==k){
cout<<"NO"<<'\n';
return;
}
for(int i=1;i<=n;i++){
if(!busy[i]){
fa=i;
break;
}
}
q.push(fa);
flag[fa]=1;
int cnt=1;
int now=0;
while(!q.empty()){
int num=q.front();
q.pop();
u.push_back(num);
for(auto x:v[num]){
if(!flag[x]){
cnt++;
flag[x]=1;
ans[now].push_back(x);
if(!busy[x]){
q.push(x);
}
}
}
now++;
}
if(cnt==n){
cout<<"YES"<<'\n';
for(int i=0;i<now;i++){
cout<<u[i]<<" "<<ans[i].size()<<" ";
for(auto x:ans[i]){
cout<<x<<" ";
}
cout<<'\n';
}
}
else{
cout<<"NO"<<'\n';
}
}
int main()
{
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
t=1;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 6580kb
input:
4 5 2 3 4 1 2 1 3 2 3 3 4 2 4
output:
YES 1 2 2 3 2 1 4
result:
wrong answer Token parameter [name=pans] equals to "YES", doesn't correspond to pattern "Yes|No"