답안 #622548

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
622548 2022-08-04T11:21:11 Z cheissmart Vision Program (IOI19_vision) C++14
14 / 100
8 ms 1188 KB
#include "vision.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define V vector
#define MP make_pair
#define EB emplace_back
#define PB push_back
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

void construct_network(int H, int W, int K) {
	int n = H, m = W;
	auto id = [&] (int i, int j) {
		return i * W + j;
	};
	// vi aux;
	// for(int i = 0; i < H; i++) {
	// 	for(int j = 0; j < W; j++) {
	// 		vi tt;
	// 		for(int ii = 0; ii < H; ii++) if(abs(ii - i) <= K) {
	// 			int dd = K - abs(ii - i);
	// 			for(int jj:{j + dd, j - dd}) if(jj >= 0 && jj < W) {
	// 				tt.PB(id(ii, jj));
	// 			}
	// 		}
	// 		if(SZ(tt)) {
	// 			int OR = add_or(tt);
	// 			aux.PB(add_and({id(i, j), OR}));
	// 		}
	// 	}
	// }
	// add_or(aux);

	vi row(n), col(m); // xor
	for(int i = 0; i < n; i++) {
		vi tt;
		for(int j = 0; j < m; j++)
			tt.PB(id(i, j));
		row[i] = add_xor(tt);		
	}
	for(int j = 0; j < m; j++) {
		vi tt;
		for(int i = 0; i < n; i++)
			tt.PB(id(i, j));
		col[j] = add_xor(tt);
	}
	vi prow(n), pcol(m);
	vi nprow(n), npcol(m);

	prow[0] = row[0];
	for(int i = 1; i < n; i++)
		prow[i] = add_xor({prow[i - 1], row[i]});
	for(int i = 0; i < n; i++)
		nprow[i] = add_not(prow[i]);


	pcol[0] = col[0];
	for(int i = 1; i < m; i++)
		pcol[i] = add_xor({pcol[i - 1], col[i]});
	for(int i = 0; i < m; i++)
		npcol[i] = add_not(pcol[i]);

	int norow = add_and(nprow);
	int nocol = add_and(npcol);

	vi aux;
	for(int i = 0; i + 1 < n; i++) {
		vi todo;
		todo.PB(prow[i]);
		if(i) todo.PB(nprow[i - 1]);
		todo.PB(nprow[i + 1]);
		todo.PB(nocol);
		aux.PB(add_and(todo));
	}

	for(int j = 0; j < m - 1; j++) {
		vi todo;
		todo.PB(pcol[j]);
		if(j) todo.PB(npcol[j - 1]);
		todo.PB(npcol[j + 1]);
		todo.PB(norow);
		aux.PB(add_and(todo));
	}

	add_or(aux);

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1188 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 3 ms 436 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 6 ms 724 KB Output is correct
8 Correct 5 ms 724 KB Output is correct
9 Correct 8 ms 1112 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 Incorrect 0 ms 212 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -