QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#750953 | #9525. Welcome to Join the Online Meeting! | surenjamts | WA | 1ms | 3720kb | C++20 | 1.1kb | 2024-11-15 16:29:29 | 2024-11-15 16:29:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define F first
#define S second
bool yes = 1;
vector < int > vc[200045], ans[200045];
bool vis[200045], gg[200045];
int lla = 0;
void dfs( int node ){
vis[node] = 1;
lla ++;
if( gg[node] ){
return;
}
for(int i : vc[node] ){
if( vis[i] == 0 ){
ans[node].pb( i );
dfs( i );
}
}
}
signed main(){
int n, m, k;
int a, b, e;
cin >> n >> m >> k;
for(int i = 1; i <= k; i ++ ){
cin >> e;
gg[e] = 1;
}
for(int i = 1; i <= m; i ++ ){
cin >> a >> b;
vc[a].pb( b );
vc[b].pb( a );
}
for(int i = 1; i <= n; i ++ ){
if( vis[i] == 0 && gg[i] == 0 ){
dfs( i );
}
}
if( lla < n ){
cout << "No";
return 0;
}
cout << "Yes\n";
int cnt = 0;
for(int i = 1; i <= n; i ++ ){
if( vc[i].size() )
cnt ++;
}
cout << cnt << "\n";
for(int i = 1; i <= n; i ++ ){
if( ans[i].size() > 0 ){
cout << i << " " << ans[i].size() << " ";
}
for(int j : ans[i] )
cout << j << " ";
cout << "\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3720kb
input:
4 5 2 3 4 1 2 1 3 2 3 3 4 2 4
output:
Yes 4 1 1 2 2 2 3 4
result:
wrong output format Unexpected end of file - int32 expected