Submission #163349

# Submission time Handle Problem Language Result Execution time Memory
163349 2019-11-12T18:39:25 Z farmerboy Vision Program (IOI19_vision) C++14
0 / 100
6 ms 1652 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_or(a);
		rigDi1.emplace_back(g);
		rigDi2.emplace_back( add_and( {add_not(add_xor(a)), g} ) );
	}
	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_or(a);
		rigDi1.emplace_back(g);
		rigDi2.emplace_back( add_and( {add_not(add_xor(a)), g} ) );
	}

	// 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_or(a);
		lefDi1.emplace_back(g);
		lefDi2.emplace_back( add_and( {add_not(add_xor(a)), g} ) );
	}
	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_or(a);
		lefDi1.emplace_back(g);
		lefDi2.emplace_back( add_and( {add_not(add_xor(a)), g} ) );
	}

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

	cout << g << endl;

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

	cout << h << endl;

	// step 7:
	add_and({ g, add_not(h) });
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1140 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1652 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -