QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#768338 | #9525. Welcome to Join the Online Meeting! | 401rk8# | WA | 2ms | 8392kb | C++17 | 1.7kb | 2024-11-21 09:28:31 | 2024-11-21 09:28:32 |
Judging History
answer
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx;
#define For(i,x,y,...) for(int i=x,##__VA_ARGS__;i<=(y);++i)
#define rFor(i,x,y,...) for(int i=x,##__VA_ARGS__;i>=(y);--i)
#define Rep(i,x,y,...) for(int i=x,##__VA_ARGS__;i<(y);++i)
#define pb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define mem(a,x,n) memset(a,x,sizeof(*a)*((n)+2))
typedef long long LL; typedef vector<int> Vi; typedef pair<int,int> Pii;
auto ckmax=[](auto &x,auto y) { return x<y ? x=y,true : false; };
auto ckmin=[](auto &x,auto y) { return y<x ? x=y,true : false; };
sfmt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r) { return uniform_int_distribution<>(l,r)(mt); }
template<typename T=int>T read() { T x; cin>>x; return x; }
const int N = 2e5+5;
int n,m,q;
bool del[N],vis[N];
Vi e[N];
vector<pair<int,Vi>> ans;
void dfs(int u) {
if( del[u] ) return;
ans.pb(u,Vi());
for(int v : e[u]) if( !vis[v] ) vis[v] = 1, ans.back().se.pb(v);
for(int v : ans.back().se) dfs(v);
}
void MAIN() {
cin>>n>>m>>q; For(i,1,q) del[read()] = 1;
For(i,1,m, x,y) cin>>x>>y, e[x].pb(y), e[y].pb(x);
For(i,1,n) if( !del[i] ) { vis[i] = 1, dfs(i); break; }
For(i,1,n) if( !vis[i] ) { cout<<"No\n"; return; }
cout<<"Yes\n"<<sz(ans)<<'\n';
for(auto [i,j] : ans) {
cout<<i<<" "<<sz(j)<<" ";
for(int k : j) cout<<k<<" ";
cout<<'\n';
}
} signed main() {
#ifdef FS
freopen("in","r",stdin); freopen("out","w",stdout);
#endif
ios::sync_with_stdio(0);cin.tie(0);
int lft=1; while( lft-- ) {
MAIN();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 8388kb
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: 8324kb
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: 2ms
memory: 8392kb
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]