답안 #154584

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154584 2019-09-22T21:48:25 Z MetB Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
 
using namespace std;
 
typedef long long ll;
 
const ll INF = 1e9, MOD = 1e9 + 7, MOD2 = 1e6 + 3;

int a[100000], k, t, H, W, K;

struct data {

	struct segment {
	int l, r;
	} prim, weak, sec;

	int prim_res, sec_res, zero, shortcut, l, r;
} diag, antid;

/*void add_not (int x) {

	a[k] = !a[x];
	k++;
}

void add_and (vector <int> v) {
	int s = 1;

	for (int i : v)
		s &= a[i];

	a[k] = s;
	k++;
}

void add_or (vector <int> v) {
	int s = 0;

	for (int i : v)
		s |= a[i];

	a[k] = s;
	k++;
}

void add_xor (vector <int> v) {
	int s = 0;

	for (int i : v)
		s ^= a[i];

	a[k] = s;
	k++;
}*/

vector <int> tie (int a, int b)
{
	vector <int> c;

	c.push_back (a);
	c.push_back (b);

	return c;
}

void process (data diag, bool rev, int H, int W, int K) {
	vector <int> v;

	diag.l = t;

	for (int i = (rev ? 0 : -H + 1); i < (rev ? W + H - 1 : W); i++) {

		v.clear ();

		for (int j = 0; j < H; j++) {
			int ji = (rev ? i - j : j + i);

			if (0 <= ji && ji < W) {
				v.push_back (j * W + ji);
			}
		}

		t++;
		add_xor (v);
	}



	diag.r = t;

	diag.prim.l = t;
	for (int i = diag.l; i < diag.r; i++) {
		if (i - K >= diag.l) {
			add_and (tie (i - K, i));
			t++;
		}
	}

	diag.prim.r = t;
	v.clear ();
	for (int i = diag.l; i <= diag.r; i++)
		v.push_back (i);
	diag.shortcut = t + 1;
	add_or (v);
	add_not (t);
	t += 2;

	diag.zero = t;
	add_xor (tie (0, 0));
	t++;

	diag.weak.l = t;
	for (int i = diag.l; i < diag.r; i++) {
		v.clear ();
		for (int j = max (diag.l, i - K); j < min (diag.r, i + K + 1); j++) {
			if (j != i) v.push_back (j);
			else v.push_back (diag.zero);
		}
		add_or (v);
		t++;
	}
	diag.weak.r = t;

	diag.sec.l = t;
	for (int i = 0; i < diag.r - diag.l; i++) {
		add_and (tie (diag.l + i, diag.weak.l + i));
		t++;
	}
	diag.sec.r = t;

	v.clear ();
	diag.prim_res = t;
	for (int i = diag.prim.l; i < diag.prim.r; i++) {
		v.push_back (i);
	}
	add_or (v);
	t++;

	v.clear ();
	diag.sec_res = t;
	for (int i = diag.sec.l; i < diag.sec.r; i++) {
		v.push_back (i);
	}
	add_or (v);
	t++;

}

void construct_network (int H, int W, int K) {
	t = H * W;
	process (diag, false, H, W, K);
	process (antid, true, H, W, K);

	add_and (tie (diag.prim_res, antid.sec_res));
	int primsec = t;
	t++;

	add_and (tie (antid.prim_res, diag.sec_res));
	int secprim = t;
	t++;

	add_or (tie (primsec, secprim));
}

/*int main () {
	cin >> H >> W >> K;

	int x1, y1, x2, y2;

	cin >> x1 >> y1 >> x2 >> y2;

	a[x1 * W + y1] = 1;
	a[x2 * W + y2] = 1;

	k = H * W;

	construct_network (H, W, K);
}*/

Compilation message

vision.cpp: In function 'void process(data, bool, int, int, int)':
vision.cpp:91:3: error: 'add_xor' was not declared in this scope
   add_xor (v);
   ^~~~~~~
vision.cpp:101:4: error: 'add_and' was not declared in this scope
    add_and (tie (i - K, i));
    ^~~~~~~
vision.cpp:111:2: error: 'add_or' was not declared in this scope
  add_or (v);
  ^~~~~~
vision.cpp:111:2: note: suggested alternative: 'rand_r'
  add_or (v);
  ^~~~~~
  rand_r
vision.cpp:112:2: error: 'add_not' was not declared in this scope
  add_not (t);
  ^~~~~~~
vision.cpp:116:2: error: 'add_xor' was not declared in this scope
  add_xor (tie (0, 0));
  ^~~~~~~
vision.cpp:133:3: error: 'add_and' was not declared in this scope
   add_and (tie (diag.l + i, diag.weak.l + i));
   ^~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:161:2: error: 'add_and' was not declared in this scope
  add_and (tie (diag.prim_res, antid.sec_res));
  ^~~~~~~
vision.cpp:169:2: error: 'add_or' was not declared in this scope
  add_or (tie (primsec, secprim));
  ^~~~~~
vision.cpp:169:2: note: suggested alternative: 'rand_r'
  add_or (tie (primsec, secprim));
  ^~~~~~
  rand_r