답안 #742304

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
742304 2023-05-16T05:18:42 Z t6twotwo Vision Program (IOI19_vision) C++17
34 / 100
9 ms 1132 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
void AND() {
	add_and(v);
	v.clear();
}
void XOR() {
	add_xor(v);
	v.clear();
}
void OR() {
	add_or(v);
	v.clear();
}
void construct_network(int H, int W, int K) {
	int T = H * W;
	auto get = [&](int x, int y) {
		return x * W + y;
	};
	if (min(H, W) == 1) {
		if (H != 1) {
			swap(H, W);
		}
		for (int i = 0; i + K < W; i++) {
			add_and({i, i + K});
			v.push_back(T++);
		}
		OR();
		return;
	}
	if (K == 1) {
		vector<int> A(H);
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				v.push_back(get(i, j));
			}
			A[i] = T++;
			OR();
		}
		vector<int> B(W);
		for (int j = 0; j < W; j++) {
			for (int i = 0; i < H; i++) {
				v.push_back(get(i, j));
			}
			B[j] = T++;
			OR();
		}
		vector<int> C(H - 1);
		for (int i = 0; i + 1 < H; i++) {
			C[i] = T++;
			add_and({A[i], A[i + 1]});
		}
		vector<int> D(W - 1);
		for (int i = 0; i + 1 < W; i++) {
			D[i] = T++;
			add_and({B[i], B[i + 1]});
		}
		for (int i = 0; i < H; i++) {
			v.push_back(A[i]);
		}
		int x = T++;
		XOR();
		for (int i = 0; i + 1 < W; i++) {
			v.push_back(D[i]);
		}
		int y = T++;
		OR();
		int z = T++;
		add_and({x, y});
		for (int i = 0; i < W; i++) {
			v.push_back(B[i]);
		}
		int a = T++;
		XOR();
		for (int i = 0; i + 1 < H; i++) {
			v.push_back(C[i]);
		}
		int b = T++;
		OR();
		int c = T++;
		add_and({a, b});
		add_or({z, c});
		return;
	}
	if (max(H, W) <= 30) {
		vector<int> t;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				set<int> s;
				for (int k = 0; k <= K; k++) {
					if (i - k >= 0) {
						if (j - (K - k) >= 0) {
							s.insert(get(i - k, j - (K - k)));
						}
						if (j + (K - k) < W) {
							s.insert(get(i - k, j + (K - k)));
						}
					}
					if (i + k < H) {
						if (j - (K - k) >= 0) {
							s.insert(get(i + k, j - (K - k)));
						}
						if (j + (K - k) < W) {
							s.insert(get(i + k, j + (K - k)));
						}
					}
				}
				for (int x : s) {
					v.push_back(x);
				}
				T++;
				OR();
				t.push_back(T);
				add_and({get(i, j), T - 1});
				T++;
			}
		}
		add_or(t);
		return;
	}
	for (int i = 0; i <= K; i++) {
		if (i < H && K - i < W) {
			add_and({0, get(i, K - i)});
			v.push_back(T++);
		}
	}
	OR();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB WA in grader: Instruction with no inputs
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB WA in grader: Instruction with no inputs
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB WA in grader: Instruction with no inputs
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB WA in grader: Instruction with no inputs
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 1 ms 296 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 5 ms 684 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 4 ms 724 KB Output is correct
25 Correct 1 ms 300 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 9 ms 1064 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 296 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1132 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 5 ms 724 KB Output is correct
8 Correct 4 ms 724 KB Output is correct
9 Correct 8 ms 1068 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB WA in grader: Instruction with no inputs
10 Halted 0 ms 0 KB -