QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#718212 | #9525. Welcome to Join the Online Meeting! | Exile_Code# | WA | 1ms | 3848kb | C++20 | 1.6kb | 2024-11-06 19:58:29 | 2024-11-06 19:58:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define endl '\n'
#define vv vector
#define all(x) x.begin()+1,x.end()
#define int ll
#define ft first
#define sd second
void solve(){
int n,m,k;cin>>n>>m>>k;
queue<int>q;
map<int,int>mp;
for(int i=1;i<=k;i++){
int a;cin>>a;
mp[a]++;
}
vv<vv<int>>e(n+1);
for(int i=1;i<=m;i++){
int a,b;cin>>a>>b;
e[a].push_back(b);
e[b].push_back(a);
}
vv<pair<int,vv<int>>>rs;
for(int i=1;i<=n;i++){
if(mp.find(i)==mp.end()){
q.push(i);
break;
}
}
vv<int>flag(n+1);
while(q.size()){
int nd=q.front();
q.pop();
flag[nd]=1;
vv<int>now;
for(auto a:e[nd]){
if(flag[a])
continue;
now.push_back(a);
flag[a]=1;
if(mp.find(a)==mp.end())
q.push(a);
}
rs.push_back({nd,now});
}
for(int i=1;i<=n;i++)
if(!flag[i]){
cout<<"No"<<endl;
return ;
}
cout<<"Yes"<<endl;
cout<<rs.size()<<endl;
for(int i=0;i<rs.size();i++){
cout<<rs[i].first<<' '<<rs[i].second.size()<<' ';
for(auto a:rs[i].second)
cout<<a<<' ';
cout<<endl;
}
}
signed main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int _=1;
//cin>>_;
while(_--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3560kb
input:
4 5 2 3 4 1 2 1 3 2 3 3 4 2 4
output:
Yes 2 1 2 2 3 2 1 4
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
4 5 3 2 4 3 1 2 1 3 2 3 3 4 2 4
output:
No
result:
ok ok
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3848kb
input:
4 6 2 3 4 1 3 1 4 2 3 2 4 1 2 3 4
output:
Yes 2 1 3 3 4 2 2 0
result:
wrong answer Integer parameter [name=y_j] equals to 0, violates the range [1, 4]