답안 #72134

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72134 2018-08-26T05:29:46 Z BOOM Tetris for Jeff(#2197, exqt, esselem) 초코쿠키 기계 (FXCUP3_chocolate) C++17
28 / 100
600 ms 21300 KB
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <iterator>
#include <unordered_set>
#include <unordered_map>
#include <assert.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int MX = 1147483646;
const ll MX2 = 3223372036854775800;
const int MOD = 1000000007;


int main()
{
	cin.tie(NULL);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n, m, k; cin >> n >> m >> k;
	int i, j, x;
	int isL[300011] = {}, cnt1 = 0;
	int isnL[300011] = {};
	set<int> outx;
	vi comb[300011];
	for (i = 1; i <= m; i++)
	{
		cin >> x;
		outx.insert(x);
	}
	int a, b;
	for (i = 1; i <= k; i++)
	{
		cin >> a >> b;
		if (outx.find(a) != outx.end()) continue;
		if (outx.find(b) != outx.end()) continue;
		comb[a].push_back(b);
		comb[b].push_back(a);
	}
	int e; cin >> e;
	string str;
	bool f1 = 0, f2 = 0;
	for (i = 1; i <= e; i++)
	{
		cin.ignore(5); cin >> x >> str >> str;
		if (str == "BOOM")
		{
			if (outx.find(x) != outx.end()) continue;
			if (comb[x].empty())
			{
				//�̰ŵ� ó��ó��
				if (f1) continue;
				f1 = 1;
				for (int sx : outx) isL[sx]++;
				cnt1++;
			}
			else
			{
				for (int sx : comb[x]) isL[sx]++;
				cnt1++;
			}
		}
		else //ok okó���϶� ó���ѹ�
		{
			if (!f2)
			{
				f2 = 1;
				for (int sx : outx) isnL[sx]++;
			}
			if (comb[x].empty()) continue;
			for (int sx : comb[x]) isnL[sx]++;
		}
	}

	vi ans;

	for (i = 1; i <= n; i++)
	{
		if (isL[i] == cnt1 && (!isnL[i])) ans.push_back(i);
	}

	cout << ans.size() << "\n";
	for (int sx : ans) cout << sx << " ";

	return 0;
}
 

Compilation message

chocolate.cpp: In function 'int main()':
chocolate.cpp:39:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j, x;
         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 9720 KB Output is correct
2 Correct 11 ms 9720 KB Output is correct
3 Correct 18 ms 10036 KB Output is correct
4 Correct 127 ms 13896 KB Output is correct
5 Correct 12 ms 13896 KB Output is correct
6 Correct 12 ms 13896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 600 ms 21300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 9720 KB Output is correct
2 Correct 11 ms 9720 KB Output is correct
3 Correct 18 ms 10036 KB Output is correct
4 Correct 127 ms 13896 KB Output is correct
5 Correct 12 ms 13896 KB Output is correct
6 Correct 12 ms 13896 KB Output is correct
7 Incorrect 600 ms 21300 KB Output isn't correct
8 Halted 0 ms 0 KB -