답안 #433823

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
433823 2021-06-20T11:06:45 Z kostia244 Vision Program (IOI19_vision) C++17
26 / 100
62 ms 4972 KB
#include "vision.h"
#include<bits/stdc++.h>
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;

void construct_network(int n, int m, int k) {
	if(k==n+m-2) {
		add_and({0, n*m-1});
		add_and({(n-1)*m, m-1});
		add_or({n*m, n*m+1});
		return;
	}
	int sz = n*m;
	vector<int> diag(n+m-1), adiag(n+m-1);
	vector<vector<int>> diag_l(n+m-1), adiag_l(n+m-1);
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			diag_l[i+j].push_back(i*m+j);
			adiag_l[n-i-1+j].push_back(i*m+j);
		}
	}
	for(int i = 0; i < n+m-1; i++) {
		add_or(diag_l[i]);
		diag[i] = sz++;
	}
	for(int i = 0; i < n+m-1; i++) {
		add_or(adiag_l[i]);
		adiag[i] = sz++;
	}
	int d1 = -1;
	for(int i = 0; i+k < n+m-1; i++) {
		add_and({diag[i], diag[i+k]});sz++;
		if(d1 != -1) {
			add_or({sz-1, d1});sz++;
		}
		d1 = sz-1;
	}
	int a1 = -1;
	for(int i = 0; i+k < n+m-1; i++) {
		add_and({adiag[i], adiag[i+k]});sz++;
		if(a1 != -1) {
			add_or({sz-1, a1});sz++;
		}
		a1 = sz-1;
	}
	int d2 = -1;
	for(int i = 0; i+k < n+m-1; i++) {
		vector<int> gg;
		for(int j = 0; j < n+m-1; j++) if(j < i || j > i+k)
			gg.push_back(diag[j]);
		add_or(gg);sz++;
		add_not(sz-1);sz++;
		if(d2 != -1) {
			add_or({sz-1, d2});sz++;
		}
		d2 = sz-1;
	}
	int a2 = -1;
	for(int i = 0; i+k < n+m-1; i++) {
		vector<int> gg;
		for(int j = 0; j < n+m-1; j++) if(j < i || j > i+k)
			gg.push_back(adiag[j]);
		add_or(gg);sz++;
		add_not(sz-1);sz++;
		if(a2 != -1) {
			add_or({sz-1, a2});sz++;
		}
		a2 = sz-1;
	}
	//d1&&a1&&(d2|a2)
	add_or({a2, d2});sz++;
	add_and({d1, a1, sz-1});
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 1084 KB Output is correct
2 Correct 5 ms 460 KB Output is correct
3 Correct 4 ms 460 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 11 ms 1100 KB Output is correct
6 Correct 6 ms 588 KB Output is correct
7 Correct 2 ms 440 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 10 ms 1100 KB Output is correct
10 Correct 9 ms 716 KB Output is correct
11 Correct 4 ms 460 KB Output is correct
12 Correct 4 ms 564 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 11 ms 1060 KB Output is correct
16 Correct 9 ms 716 KB Output is correct
17 Correct 4 ms 460 KB Output is correct
18 Correct 4 ms 544 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 6 ms 716 KB Output is correct
4 Incorrect 4 ms 548 KB on inputs (0, 0), (3, 28), expected 1, but computed 0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 4972 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 8 ms 716 KB Output is correct
4 Correct 13 ms 1184 KB Output is correct
5 Correct 10 ms 1100 KB Output is correct
6 Correct 10 ms 1100 KB Output is correct
7 Correct 27 ms 2832 KB Output is correct
8 Correct 28 ms 2836 KB Output is correct
9 Correct 62 ms 4924 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -