제출 #824992

#제출 시각아이디문제언어결과실행 시간메모리
824992phoenixVision Program (IOI19_vision)C++17
100 / 100
33 ms4472 KiB
#include<bits/stdc++.h>
#include "vision.h"

using namespace std;

vector<int> rows;
vector<int> cols;

int f(int k) {
	vector<int> w;
	for(int i = 0; i < (int)rows.size() - k; i++) {
		vector<int> v;
		for(int j = 0; j <= k; j++) v.push_back(rows[i + j]);
		int t1 = add_or(v);
		int t2 = add_xor(v);
		w.push_back(add_xor({t1, t2}));
	}
	int t1 = add_or(w);
	w.clear();
	for(int c : rows) 
		w.push_back(c);
	t1 = add_or({t1, add_xor(w)});
	w.clear();
	for(int i = 0; i < (int)cols.size() - k; i++) {
		vector<int> v;
		for(int j = 0; j <= k; j++) v.push_back(cols[i + j]);
		int t1 = add_or(v);
		int t2 = add_xor(v);
		w.push_back(add_xor({t1, t2}));
	}
	int t2 = add_or(w);
	for(int c : cols) 
		w.push_back(c);
	t2 = add_or({t2, add_xor(w)});
	return add_and({t1, t2});
}

void construct_network(int H, int W, int K) {
	for(int x = 0; x <= H + W - 2; x++) {
		vector<int> v;
		for(int i = 0; i <= x; i++) {
			int j = x - i;
			if(i < H && j < W) 
				v.push_back(i * W + j);
		}
		if(v.empty()) continue;
		rows.push_back(add_or(v));
	}
	for(int y = -W + 1; y <= H - 1; y++) {
		vector<int> v; 
		for(int i = 0; i < H; i++) {
			int j = i - y;
			if(j < W && j >= 0) 	
				v.push_back(i * W + j);
		}
		if(v.empty()) continue;
		cols.push_back(add_or(v));
	}
	int t1 = f(K), t2 = f(K - 1);
	t2 = add_not(t2);
	add_and({t1, t2});
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...