답안 #201624

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
201624 2020-02-11T12:54:28 Z khulegub Vision Program (IOI19_vision) C++14
0 / 100
28 ms 2544 KB
#include "vision.h"
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define rr first
#define cc second

using namespace std;

typedef pair<int, int> pii;

int hh, ww, kk;

pii to_pair(int x){
	return mp(x / ww, x % ww);
}
int to_linear(pii x){
	return x.rr * ww + x.cc; 
}

void construct_network(int H, int W, int K) {

	// proj y
	hh = H, ww = W, kk = K;

	int one = add_or( {0, add_not(0)} ), zero = add_not(one);

	vector<int> proj_hor, hor;
	vector<int> proj_ver, ver;

	int bitlen = 9;

	vector<int> counter;

	for (int i = 0; i < ww; i++){
		vector<int> send;
		for (int j = 0; j < hh; j++){
			send.pb(to_linear(mp(i, j)));
		}
		proj_hor.pb(add_or(send));
	}
	for (int i = 0; i < ww; i++){
		vector<int> send_pre, send_suf;
		for (int j = 0; j <= i; j++){
			send_pre.pb(proj_hor[j]);
		}
		for (int j = i; j < ww; j++){
			send_suf.pb(proj_hor[j]);
		}
		hor.pb( add_and({add_or(send_pre), add_or(send_suf)}) );
	}
	for (int i = 0; i < hh; i++){
		vector<int> send;
		for (int j = 0; j < ww; j++){
			send.pb(to_linear(mp(j, i)));
		}
		proj_ver.pb(add_or(send));
	}

	for (int i = 0; i < hh; i++){
		vector<int> send_pre, send_suf;
		for (int j = 0; j <= i; j++){
			send_pre.pb(proj_ver[j]);
		}
		for (int j = i; j < hh; j++){
			send_suf.pb(proj_ver[j]);
		}
		ver.pb( add_and({add_or(send_pre), add_or(send_suf)}) );
	}

	// initialize
	for (int i = 0; i < bitlen; i++){
		counter.pb(zero);
	}

	for (int j = 0; j < ww; j++){
		int adder = hor[j];
		for (int i = 0; i < bitlen; i++){
			int tmp = counter[i];
			counter[i] = add_xor({counter[i], adder});
			adder = add_and({tmp, adder});
		}
	}
	for (int j = 0; j < hh; j++){
		int adder = ver[j];
		for (int i = 0; i < bitlen; i++){
			int tmp = counter[i];
			counter[i] = add_xor({counter[i], adder});
			adder = add_and({tmp, adder});
		}
	}

	kk = kk + 2;
	int last = one;
	vector<int> kkbits;

	for (int i = 0; i < bitlen; i++){
		kkbits.pb(kk % 2);
		kk /= 2;
	}

	for (int i = 0; i < bitlen; i++){
		if (kkbits[i]){
			last = add_and({last, counter[i]});
		}
		else{
			last = add_and({last, add_not(counter[i]) });
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 360 KB Output is correct
3 Incorrect 8 ms 632 KB on inputs (0, 0), (1, 0), expected 1, but computed 0
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 2544 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Incorrect 8 ms 632 KB on inputs (96, 18), (96, 19), expected 1, but computed 0
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -