QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#718292 | #9525. Welcome to Join the Online Meeting! | tea | WA | 8ms | 51912kb | C++14 | 3.0kb | 2024-11-06 20:11:56 | 2024-11-06 20:11:56 |
Judging History
answer
// #pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define pb push_back
#define st first
#define nd second
#define PII pair<ll, ll>
#define D(x, y) cout << x << "=" << y << endl;
#define fcout(x, n) cout << fixed << setprecision(x) << n << endl;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
// #define int long long
// #define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
const ll inf = 0x3f3f3f3f;
const int N = 1e6 + 10;
const int M = 1e9+7;
inline ll read()
{
ll x = 0;
bool f = 1;
char c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-')
f = 0;
for (; isdigit(c); c = getchar())
x = (x << 3) + (x << 1) + c - '0';
return f ? x : 0 - x;
}
inline void out(ll x)
{
if (x < 0)
putchar('-'), x = -x;
if (x > 9)
out(x / 10);
putchar(x % 10 + '0');
}
// __int128 rd()
// {
// char arr[30];
// __int128 res = 0;
// scanf("%s", arr);
// for (int i = 1; i <= strlen(arr); i++)
// {
// res *= 10;
// res += arr[i]-'0';
// }
// return res;
// }
// void pt(__int128 num)
// {
// if (num > 9) pt(num / 10);
// putchar(num % 10 + '0');
// }
ll n, m;
bool yy[N]={0};
bool vis[N]={0};
vector< vector<ll> >v(N),ans(N);
ll sum[N];
queue<ll>q;
ll bfs(ll x,ll l)
{
while(!q.empty())
{
ll t=q.front();
q.pop();
ans[l].pb(t);
for(auto i:v[t])
{
if(!vis[i])
{
if(!yy[i]) q.push(i);
vis[i]=1;
ans[l].pb(i);
sum[l]++;
}
}
l++;
}
return l;
}
void solve()
{
ll k;
cin>>n>>m>>k;
rep(i,0,k)
{
ll t;cin>>t;
yy[t]=1;
}
rep(i,0,m)
{
ll x,y;cin>>x>>y;
v[x].pb(y);
v[y].pb(x);
}
rep(i,1,n+1)
{
if(yy[i])
{
bool b=0;
for(auto j:v[i])
{
if(!yy[j])
{
b=1;
break;
}
}
if(!b) return cout<<"NO\n",void();
}
}
cout<<"Yes\n";
ll l;
rep(i,1,n+1)
{
if(!yy[i])
{
q.push(i);vis[i]=1;
l=bfs(i,0);
break;
}
}
rep(i,0,l)
{
cout<<*ans[i].begin()<<" "<<sum[i]<<" ";
auto it=ans[i].begin()+1;
for(;it!=ans[i].end();it++)
{
cout<<*it<<" ";
}
cout<<endl;
}
}
signed main()
{
IOS
// freopen("../.vscode/io/in.txt","r",stdin),freopen("../.vscode/io/out.txt","w",stdout);
ll T = 1;
// cin >> T;
while (T--)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 8ms
memory: 51912kb
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 on step #1, member 2 has been invited