Submission #298531

# Submission time Handle Problem Language Result Execution time Memory
298531 2020-09-13T04:44:59 Z JPN20 Vision Program (IOI19_vision) C++17
0 / 100
11 ms 1152 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

void Reigai(int H, int W, int K) {
	vector<int> vec;
	int cnt = H * W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			for (int k = 0; k < H; k++) {
				for (int l = 0; l < W; l++) {
					if (abs(i - j) + abs(k - l) != K) continue;
					int c1 = i * W + j;
					int c2 = k * W + l;
					if (c1 > c2) continue;
					add_and(vector<int>{c1, c2});
					vec.push_back(cnt);
					cnt++;
				}
			}
		}
	}
	add_or(vec);
}

void solve_Subtask7(int H, int W) {
	for (int i = 0; i < H - 1; i++) {
		int c1 = H * W + i;
		int c2 = H * W + (i + 1);
		add_and(vector<int>{c1, c2});
	}
	for (int i = 0; i < W - 1; i++) {
		int c1 = H * W + H + i;
		int c2 = H * W + H + (i + 1);
		add_and(vector<int>{c1, c2});
	}
	int base = H * W + H + W + (H - 1) + (W - 1);
	vector<int> d1; for (int i = 0; i < H; i++) d1.push_back(H * W + i);
	vector<int> d2; for (int i = 0; i < W; i++) d2.push_back(H * W + H + i);
	vector<int> d3; for (int i = 0; i < H - 1; i++) d3.push_back(H * W + H + W + i);
	vector<int> d4; for (int i = 0; i < W - 1; i++) d4.push_back(H * W + H + W + (H - 1) + i);
	add_xor(d1);
	add_xor(d2);
	add_xor(d3);
	add_xor(d4);
	add_and(vector<int>{base + 0, base + 3});
	add_and(vector<int>{base + 1, base + 2});
	add_or(vector<int>{base + 4, base + 5});
}

void construct_network(int H, int W, int K) {
	if (H == 1 || W == 1) {
		Reigai(H, W, K);
		return;
	}
		
	// Step #1. Yoko
	for (int i = 0; i < H; i++) {
		vector<int> vec;
		for (int j = 0; j < W; j++) vec.push_back(i * W + j);
		add_or(vec);
	}
	
	// Step #2. Tate
	for (int i = 0; i < W; i++) {
		vector<int> vec;
		for (int j = 0; j < H; j++) vec.push_back(j * W + i);
		add_or(vec);
	}
	
	solve_Subtask7(H, W);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 416 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1152 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Incorrect 1 ms 384 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -