답안 #232278

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232278 2020-05-16T14:25:01 Z pedy4000 Ili (COI17_ili) C++14
컴파일 오류
0 ms 0 KB
#include <algorithm>
#include <iostream>
#include <bitset>
#include <vector>
using namespace std;

const int N = 1e4 + 8;
int n, m;
string s;
int type[N * 2];
bool can[N * 2][2];
bool mark[N * 2];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m >> s;
	for (int i = 0; i < m; i++)
		type[i] = (s[i] == '?'? 2: s[i] - '0');
	for (int i = m; i < m + n; i++)
		type[i] = 2;

	for (int i = 0; i < m; i++)
		for (int j = 0; j < 2; j++) {
			char c;
			int ind;
			cin >> c >> ind;
			ind--;
			if (c == 'x')
				ind += m;

			in[i].push_back(ind);
			out[ind].push_back(i);
		}

	for (int mask = 0; mask < (1 << n); mask++) {
		for (int i = m; i < m + n; i++)
			mark[i] = (mask >> (i - m)) & 1;
		for (int i = 0; i < m; i++)
			mark[i] = mark[in[i][0]] | mark[in[i][1]];

		bool ok = true;
		for (int i = 0; i < m + n; i++)
			if (type[i] < 2 && type[i] != mark[i])
				ok = false;

		if (ok)
			for (int i = 0; i < m; i++)
				can[i][mark[i]] = true;
	}

	for (int i = 0; i < m; i++) {
		if (can[i][0] && !can[i][1])
			cout << '0';
		if (!can[i][0] && can[i][1])
			cout << '1';
		if (can[i][0] && can[i][1])
			cout << '?';
	}
	return 0;
}

Compilation message

ili.cpp: In function 'int main()':
ili.cpp:31:4: error: 'in' was not declared in this scope
    in[i].push_back(ind);
    ^~
ili.cpp:31:4: note: suggested alternative: 'ind'
    in[i].push_back(ind);
    ^~
    ind
ili.cpp:32:4: error: 'out' was not declared in this scope
    out[ind].push_back(i);
    ^~~
ili.cpp:32:4: note: suggested alternative: 'putw'
    out[ind].push_back(i);
    ^~~
    putw
ili.cpp:39:19: error: 'in' was not declared in this scope
    mark[i] = mark[in[i][0]] | mark[in[i][1]];
                   ^~
ili.cpp:39:19: note: suggested alternative: 'i'
    mark[i] = mark[in[i][0]] | mark[in[i][1]];
                   ^~
                   i