QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#706690 | #9525. Welcome to Join the Online Meeting! | leafmaple# | WA | 2ms | 7748kb | C++20 | 1.1kb | 2024-11-03 12:59:31 | 2024-11-03 12:59:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e6+5;
vector<int>g[N];
int a[N], vis[N], del[N];
int n, m, k;
vector<pair<int,vector<int>>>ans;
int cnt = 0;
void dfs(int u, int v){
vector<int>cur;
for(auto v: g[u])if(!vis[v]){
vis[v] = 1;
cnt++;
cur.push_back(v);
if(!del[v]){
dfs(v, u);
}
}
// cout << u << ' ';
// for(auto x: cur) cout << x << ' ';
// cout<<endl;
if(!cur.empty())ans.push_back({u, cur});
}
signed main (){
std::ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m >> k;
for(int i=1; i<=k; i++){
cin >> a[i];
del[a[i]] = 1;
}
for(int i=1; i<=m; i++){
int u, v; cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
for(int i=1; i<=n; i++)if(!del[i]){
cnt ++; vis[i] = 1;
dfs(i, 0);
break;
}
reverse(ans.begin(), ans.end());
if(cnt != n) cout << "No" << endl;
else {
cout<<"Yes"<<endl;
for(auto [id, vec]: ans){
cout << id << ' ';
cout << vec.size() << ' ';
for(auto x: vec) cout << x << ' ';
cout<<endl;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 7748kb
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