Submission #72138

# Submission time Handle Problem Language Result Execution time Memory
72138 2018-08-26T05:30:41 Z https://blog.naver.com/nywoo19(#2158, HawkBreaker, njchung99, yu0524) Chocolate Cookie Machine (FXCUP3_chocolate) C++17
0 / 100
491 ms 12796 KB
#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 time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 491 ms 12796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -