Submission #72138

#TimeUsernameProblemLanguageResultExecution timeMemory
72138https://blog.naver.com/nywoo19 (#118)Chocolate Cookie Machine (FXCUP3_chocolate)C++17
0 / 100
491 ms12796 KiB
#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; 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 (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 << ' '; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...