QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#746185 | #9525. Welcome to Join the Online Meeting! | ucup-team3702# | WA | 0ms | 9388kb | C++14 | 1.6kb | 2024-11-14 13:45:06 | 2024-11-14 13:45:07 |
Judging History
answer
#include <map>
#include <set>
#include <list>
#include <array>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <memory>
#include <vector>
#include <random>
#include <string>
#include <cassert>
#include <climits>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define rep(i, s, e) for (int i = s; i <= e; ++i)
#define per(i, s, e) for (int i = s; i >= e; --i)
using i64 = long long;
using namespace std;
const int N = 2e5 + 10;
int n, m, k, dep[N], pre[N];
bool tag[N], vis[N];
vector <int> e[N], o;
void dfs(int u) {
if (vis[u]) return;
vis[u] = true;
o.emplace_back(u);
if (!tag[u]) {
for (int v : e[u]) {
if (!vis[v]) {
dep[v] = dep[u] + 1, pre[v] = u;
dfs(v);
}
}
}
}
void solve() {
cin >> n >> m >> k;
rep(i, 1, n) pre[i] = 0, tag[i] = false, e[i].clear();
rep(i, 1, k) {
int x;
cin >> x;
tag[x] = true;
}
rep(i, 1, m) {
int u, v;
cin >> u >> v;
e[u].emplace_back(v);
e[v].emplace_back(u);
}
o.clear();
rep(i, 1, n) if (!tag[i]) {
dfs(i);
break;
}
if (o.size() < n) {
printf("No\n");
return;
}
printf("Yes\n");
printf("%d\n", n - 1);
for (int i = 1; i < n; ++i) {
printf("%d 1 %d\n", pre[o[i]], o[i]);
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int tc = 1;
while (tc--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 9388kb
input:
4 5 2 3 4 1 2 1 3 2 3 3 4 2 4
output:
Yes 3 1 1 2 2 1 3 2 1 4
result:
wrong answer on step #3, member 2 has invited someone before