답안 #163324

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
163324 2019-11-12T15:57:20 Z farmerboy Vision Program (IOI19_vision) C++14
12 / 100
22 ms 2036 KB
#include <bits/stdc++.h>
#include "vision.h"

using namespace std;

vector<int> checkBlock(vector<int> &a, vector<int> &b, int K) {
	vector<int> res;
	for (int i = K-1; i < int(a.size()); i++) {
		vector<int> g, h;
		for (int j = i - K + 1; j <= i; j++) {
			h.emplace_back(b[j]);
			g.emplace_back(a[j]);
		}
		res.emplace_back(add_and({ add_or(g), add_or({ add_or(h), add_and({ add_not(add_or(h)), add_not(add_xor(g)) }) }) }));
	}
	return res;
}

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

	vector<int> lefDi1, rigDi1;
	vector<int> lefDi2, rigDi2;

	// step 1 + 2: right diagonal
	for (int i = H-1; i >= 0; i--) {
		vector<int> a;
		for (int x = i, y = 0; x < H && y < W; x++, y++) a.emplace_back(x * W + y);
		int g = add_xor(a);
		rigDi1.emplace_back(g);
		rigDi2.emplace_back( add_and( {add_not(g), add_or(a)} ) );
	}
	for (int i = 1; i < W; i++) {
		vector<int> a;
		for (int x = 0, y = i; x < H && y < W; x++, y++) a.emplace_back(x * W + y);
		int g = add_xor(a);
		rigDi1.emplace_back(g);
		rigDi2.emplace_back( add_and( {add_not(g), add_or(a)} ) );
	}

	// step 1 + 2: left diagonal
	for (int i = 0; i < W; i++) {
		vector<int> a;
		for (int x = 0, y = i; x < H && y >= 0; x++, y--) a.emplace_back(x * W + y);
		int g = add_xor(a);
		lefDi1.emplace_back(g);
		lefDi2.emplace_back( add_and( {add_not(g), add_or(a)} ) );
	}
	for (int i = 1; i < H; i++) {
		vector<int> a;
		for (int x = i, y = W-1; x < H && y >= 0; x++, y--) a.emplace_back(x * W + y);
		int g = add_xor(a);
		lefDi1.emplace_back(g);
		lefDi2.emplace_back( add_and( {add_not(g), add_or(a)} ) );
	}

	// step 3-4-5:
	int g = add_and({ add_or(checkBlock(lefDi1, lefDi2, K+1)), add_or(checkBlock(rigDi1, rigDi2, K+1)) });

	// step 6:
	int h = add_and({ add_or(checkBlock(lefDi1, lefDi2, K)), add_or(checkBlock(rigDi1, rigDi2, K)) });

	// step 7:
	add_and({ g, add_not(h) });
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Incorrect 2 ms 392 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Incorrect 2 ms 392 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Incorrect 2 ms 392 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Incorrect 2 ms 392 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1140 KB Output is correct
2 Correct 20 ms 2012 KB Output is correct
3 Correct 21 ms 2036 KB Output is correct
4 Correct 3 ms 508 KB Output is correct
5 Correct 8 ms 1140 KB Output is correct
6 Correct 19 ms 1908 KB Output is correct
7 Correct 18 ms 1784 KB Output is correct
8 Correct 4 ms 504 KB Output is correct
9 Correct 7 ms 1140 KB Output is correct
10 Correct 18 ms 1908 KB Output is correct
11 Correct 22 ms 2036 KB Output is correct
12 Correct 20 ms 2036 KB Output is correct
13 Correct 16 ms 1660 KB Output is correct
14 Correct 4 ms 508 KB Output is correct
15 Correct 7 ms 1136 KB Output is correct
16 Correct 18 ms 1908 KB Output is correct
17 Correct 20 ms 2036 KB Output is correct
18 Correct 21 ms 2036 KB Output is correct
19 Correct 16 ms 1528 KB Output is correct
20 Correct 3 ms 504 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Incorrect 2 ms 256 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1652 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Incorrect 2 ms 392 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -