Submission #72285

# Submission time Handle Problem Language Result Execution time Memory
72285 2018-08-26T06:49:04 Z https://blog.naver.com/nywoo19(#2158, HawkBreaker, njchung99, yu0524) Chocolate Cookie Machine (FXCUP3_chocolate) C++14
0 / 100
3 ms 616 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[1001], danger[1001];
int tmp[1001] = { 0 , };
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;
					tmp[j] = mul;
				}
				if (ok == 1) {
					for (auto j : dan) {
						check[j] = 1;
					}
				}
				if (ok2 == 1) {
					ok2 = 2;

					for (int i = 1; i <= N; ++i) {
						if (tmp[i] != mul && danger[i] == 0) {
							check[i] = -1;
						}
					}
				}

			}
			else if (ok2 == 0) {
				ok2 = 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);
		}
		else if (check[i] == 0 && ok2 == 1) {
			ans.push_back(i);
		}
	}

	cout << ans.size() << '\n';
	for (auto res : ans) {
		cout << res << ' ';
	}

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 616 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -