QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#748253 | #9525. Welcome to Join the Online Meeting! | proking# | WA | 0ms | 15364kb | C++14 | 966b | 2024-11-14 19:50:04 | 2024-11-14 19:50:04 |
Judging History
answer
#include <bits/stdc++.h>
#define F(i, a, b) for (int i = a; i <= b; i ++)
#define pb push_back
#define putc putchar
using namespace std;
const int N = 2e5 + 10;
int n, m, k, x, y, a[N], bz[N], st, en, Q[N], flag[N], cnt;
vector <int> e[N], w[N], s;
int main() {
// freopen("data.in","r",stdin);
scanf("%d %d %d", &n, &m, &k);
F(i, 1, k) scanf("%d", &a[i]), bz[a[i]] = 1;
F(i, 1, m) scanf("%d %d", &x, &y), e[x].pb(y), e[y].pb(x);
F(j, 1, n)
if (!bz[j]) {
Q[++ en] = j; flag[j] = 1;
while (st ++ < en) {
int k = Q[st];
if (bz[k]) continue;
++ cnt;
s.pb(k);
for (auto x : e[k])
if (!flag[x])
flag[x] = 1, w[k].pb(x), Q[++ en] = x;
}
if (en == n) {
puts("Yes");
printf("%d\n", cnt);
for (auto x : s) {
printf("%d %d ", x, w[x].size());
for (auto y : w[x])
printf("%d ", y);
putc('\n');
}
}
else
puts("No");
break;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 14484kb
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: 15364kb
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: 0ms
memory: 15160kb
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]