답안 #1044028

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1044028 2024-08-05T06:30:59 Z yanb Vision Program (IOI19_vision) C++14
0 / 100
4 ms 1240 KB
#include <bits/stdc++.h>
#include "vision.h"

using namespace std;

void def(int Y, int X, int K) {
	vector<int> ox(X);
	for (int i = 0; i < X; i++) {
		vector<int> Ns(Y);
		for (int j = 0; j < Y; j++) {
			Ns[j] = j * X + i;
		}
		ox[i] = add_or(Ns);
	}

	vector<int> oy(Y);
	for (int i = 0; i < Y; i++) {
		vector<int> Ns(X);
		for (int j = 0; j < X; j++) {
			Ns[j] = j + i * X;
		}
		oy[i] = add_or(Ns);
	}

	vector<int> dx(X);
	vector<int> Ns;
	for (int i = 0; i < X; i++) Ns.push_back(ox[i]);
	dx[0] = add_xor(Ns);
	for (int d = 1; d < X; d++) {
		vector<int> Ns;
		for (int i = 0; i + d < X; i++) {
			Ns.push_back(add_and({ox[i], ox[i + d]}));
		}
		dx[d] = add_or(Ns);
	}

	vector<int> dy(Y);
	Ns.clear();
	for (int i = 0; i < Y; i++) Ns.push_back(oy[i]);
	dy[0] = add_xor(Ns);
	for (int d = 1; d < Y; d++) {
		vector<int> Ns;
		for (int i = 0; i + d < Y; i++) {
			Ns.push_back(add_and({oy[i], oy[i + d]}));
		}
		dy[d] = add_or(Ns);
	}

	Ns.clear();
	for (int x = 0; x < X; x++) {
		for (int y = 0; y < Y; y++) {
			if (x + y == K) {
				Ns.push_back(add_and({dx[x], dy[y]}));
			}
		}
	}

	add_or(Ns);
}

void k1(int Y, int X, int K) {
	vector<int> ox(X);
	for (int i = 0; i < X; i++) {
		vector<int> Ns(Y);
		for (int j = 0; j < Y; j++) {
			Ns[j] = j * X + i;
		}
		ox[i] = add_or(Ns);
	}

	vector<int> oy(Y);
	for (int i = 0; i < Y; i++) {
		vector<int> Ns(X);
		for (int j = 0; j < X; j++) {
			Ns[j] = j + i * X;
		}
		oy[i] = add_or(Ns);
	}

	vector<int> dx(X);
	vector<int> Ns;
	for (int i = 0; i < X; i++) Ns.push_back(ox[i]);
	dx[0] = add_xor(Ns);
	for (int d = 1; d < 2; d++) {
		vector<int> Ns;
		for (int i = 0; i + d < X; i++) {
			Ns.push_back(add_and({ox[i], ox[i + d]}));
		}
		dx[d] = add_or(Ns);
	}

	vector<int> dy(Y);
	Ns.clear();
	for (int i = 0; i < Y; i++) Ns.push_back(oy[i]);
	dy[0] = add_xor(Ns);
	for (int d = 1; d < 2; d++) {
		vector<int> Ns;
		for (int i = 0; i + d < Y; i++) {
			Ns.push_back(add_and({oy[i], oy[i + d]}));
		}
		dy[d] = add_or(Ns);
	}

	Ns.clear();
	for (int x = 0; x < X; x++) {
		for (int y = 0; y < Y; y++) {
			if (x + y == K) {
				Ns.push_back(add_and({dx[x], dy[y]}));
			}
		}
	}

	add_or(Ns);
}

void construct_network(int Y, int X, int K) {
	if (K == 1) k1(Y, X, K);
	else def(Y, X, K);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 984 KB Output is correct
5 Correct 2 ms 984 KB Output is correct
6 Correct 2 ms 984 KB Output is correct
7 Correct 2 ms 984 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Incorrect 1 ms 1240 KB WA in grader: Too many instructions
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1116 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB WA in grader: Instruction with no inputs
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -