QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#709377 | #9525. Welcome to Join the Online Meeting! | 0x3fffffff | WA | 38ms | 15588kb | C++23 | 1.4kb | 2024-11-04 14:28:15 | 2024-11-04 14:28:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m, k;
cin >> n >> m >> k;
vector<int>a(n + 1);
vector<vector<int>>e(n + 1);
for (int i = 1;i <= k;i++) {
int x;cin >> x;
a[x] = 1;
}
vector<int>vis(n + 1);
map<int, vector<int>>mp;
for (int i = 1;i <= m;i++) {
int a, b;cin >> a >> b;
e[a].push_back(b);
e[b].push_back(a);
}
int fi = 0;
for (int i = 1;i <= n;i++) {
if (a[i])continue;
if (!fi) {
vis[i] = 1;
fi = 1;
}
else if (!vis[i])continue;
for (auto v : e[i]) {
if (!vis[v]) {
mp[i].push_back(v);
vis[v] = 1;
}
}
}
for (int i = 1;i <= n;i++) {
if (!vis[i]) {
cout << "No\n";return;
}
}
cout << "Yes\n";
cout << mp.size() << "\n";
for (int i = 1;i <= n;i++) {
if (mp[i].size()) {
cout << i << " " << mp[i].size() << " ";
for (auto x : mp[i]) {
cout << x << " ";
}
cout << "\n";
}
}
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int T = 1;
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
// cin >> T;
while (T--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3532kb
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: 3596kb
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: 3752kb
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: 0
Accepted
time: 0ms
memory: 3812kb
input:
6 6 0 1 2 2 3 3 1 4 5 5 6 6 4
output:
No
result:
ok ok
Test #5:
score: -100
Wrong Answer
time: 38ms
memory: 15588kb
input:
200000 199999 2 142330 49798 49798 116486 116486 64386 64386 192793 192793 61212 61212 138489 138489 83788 83788 89573 89573 8596 8596 156548 156548 41800 41800 14478 14478 27908 27908 82806 82806 9353 9353 160166 160166 92308 92308 36265 36265 126943 126943 190578 190578 191148 191148 177381 177381...
output:
No
result:
wrong answer jury has found a solution, but participant hasn't