QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#742793 | #9525. Welcome to Join the Online Meeting! | feng_Lrefrain | WA | 1ms | 3812kb | C++20 | 2.0kb | 2024-11-13 17:19:50 | 2024-11-13 17:19:55 |
Judging History
answer
/*
* ============================
* @Author: feng_Lrefrain
* @DateTime: 2024-11-13 16:38:31
* ============================
*/
#include <bits/stdc++.h>
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define rep(I,S,N) for(int I=(S);I<(N);++I)
#define per(I,S,N) for(int I=(N)-1;I>=(S);--I)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
typedef long long ll;
typedef double db;
//int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
//inline ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
//inline ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
//inline ll ksm(ll a,ll b,ll p) {ll ans=1;while(b){if(b&1)ans=(ans*a)%p;b>>=1;a=(a*a)%p;}return ans%p;}
//inline ll lowbit(int x) {return x&(-x);}
//inline int read() {
// int x = 0;
// char ch = getchar();
// while (ch < '0' || ch > '9') ch = getchar();
// while (ch <= '9' && ch >= '0') {
// x = (x << 1) + (x << 3) + (ch ^ 48);
// ch = getchar();
// }
// return x;
//}
const int N = 2e5 + 10, M = 998244353, MM = 1e9 + 7, inf = 1e18;
void solve() {
int n, m, k; cin >> n >> m >> k;
map<int, int> mp, mp1;
vector<vi> a(n + 1);
rep(i, 0, k) {
int tmp; cin >> tmp;
mp[tmp] = 1;
}
rep(i, 0, m) {
int u, v; cin >> u >> v;
if (!mp[u]) {
if (!mp1[v]) {
a[u].pb(v);
mp1[v] = 1;
}
}
else if (!mp[v]) {
if (!mp1[u]) {
a[v].pb(u);
mp1[u] = 1;
}
}
}
int sum = 0, cnt = 0;
rep(i, 1, n + 1) {
if (SZ(a[i])) {
sum += SZ(a[i]);
cnt ++;
}
}
if (sum + cnt < n) {
cout << "No\n";
return;
}
cout << "Yes\n" << cnt << '\n';
rep(i, 1, n + 1) {
if (SZ(a[i])) {
cout << i << " " << SZ(a[i]) << " ";
for (auto &j : a[i]) {
cout << j << " ";
}
cout << '\n';
}
}
}
/*
*/
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int _ = 1;
// cin >> _;
while (_ --) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3512kb
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: 3528kb
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: 0
Accepted
time: 0ms
memory: 3532kb
input:
4 6 2 3 4 1 3 1 4 2 3 2 4 1 2 3 4
output:
Yes 1 1 3 3 4 2
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3812kb
input:
6 6 0 1 2 2 3 3 1 4 5 5 6 6 4
output:
Yes 6 1 1 2 2 1 3 3 1 1 4 1 5 5 1 6 6 1 4
result:
wrong answer on step #3, member 1 has been invited