#include <iostream>
#include <algorithm>
#include <string.h>
#include <vector>
#include <string>
using namespace std;
int N, M, K, E, x, y, mul;
vector<vector<int>> adj;
vector<int> dan;
int check[300001], danger[300001];
string str;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> N >> M >> K;
for (int i = 0; i < M; ++i) {
cin >> x;
danger[x] = 1;
dan.push_back(x);
}
adj.resize(N + 1);
for (int i = 0; i < K; ++i) {
cin >> x >> y;
adj[x].push_back(y);
adj[y].push_back(x);
}
cin >> E;
bool ok = 1, ok2 = 0;
for (int i = 0; i < E; ++i) {
cin >> str; cin >> str;
cin >> mul;
cin >> str; cin >> str;
if (str[0] == 'B') {
if (danger[mul] == 0) {
for (auto j : adj[mul]) {
if (check[j] != -1) check[j] = 1;
}
if (ok == 1) {
for (auto j : dan) {
check[j] = 1;
}
}
}
else if (ok2 == 0) {
ok2 = 1;
for (int i = 1; i <= N; ++i) {
if (check[i] == 0) check[i] = 1;
}
}
}
else if (str[0] == 'O') {
if (ok) {
ok = 0;
for (auto j : dan) {
check[j] = -1;
}
}
for (auto j : adj[mul]) {
check[j] = -1;
}
}
}
vector<int> ans;
for (int i = 1; i <= N; ++i) {
if (check[i] == 1) {
ans.push_back(i);
}
}
cout << ans.size() << '\n';
for (auto res : ans) {
cout << res << ' ';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
252 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
650 ms |
13028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
252 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |