QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#748253#9525. Welcome to Join the Online Meeting!proking#WA 0ms15364kbC++14966b2024-11-14 19:50:042024-11-14 19:50:04

Judging History

This is the latest submission verdict.

  • [2024-11-14 19:50:04]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 15364kb
  • [2024-11-14 19:50:04]
  • Submitted

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]