Submission #297346

# Submission time Handle Problem Language Result Execution time Memory
297346 2020-09-11T14:01:43 Z mode149256 Vision Program (IOI19_vision) C++14
0 / 100
1000 ms 384 KB
#include<bits/stdc++.h>
#include "vision.h"
using namespace std;
#define x first
#define y second

using vi = vector<int>;
using ll = long long;
using vii = vector<vi>;
using pi = pair<int, int>;

int j = 0;
int h, w, k;

int con(pi a) {
	return a.x * w + a.y;
}
pi con(int a) {
	return {a / w, a % w};
}

int valid(pi a) {
	return int(0 <= a.x and a.x < h and 0 <= a.y and a.y < w);
}

int valid(int a) {
	return valid(con(a));
}

void findKit(int i, vi &kit) {
	pi prad = con(i);
	pi c = prad;
	c.y += k;
	if (valid(c)) kit.emplace_back(con(c));

	for (;;)
	{
		c.y--;
		c.x++;
		if (valid(c))
			kit.emplace_back(con(c));

		if (c.y == prad.y) break;
	}

	for (;;)
	{
		c.y--;
		c.x--;
		if (valid(c))
			kit.emplace_back(con(c));

		if (c.x - 1 == prad.x) break;
	}
}

void construct_network(int H, int W, int K) {
	h = H;
	w = W;
	k = K;
	vi andai;

	for (int i = 0; i < H * W; ++i)
	{
		vi kit;
		findKit(i, kit);
		if (kit.empty()) continue;

		int n = add_or(kit);
		int d = add_and({i});

		andai.emplace_back(add_and({d, n}));
	}

	add_or(andai);
	// std::vector<int> Ns;
	// Ns = {0, 1};
	// int a = add_and(Ns);
	// Ns = {0, a};
	// int b = add_or(Ns);
	// Ns = {0, 1, b};
	// int c = add_xor(Ns);
	// add_not(c);
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -