제출 #198772

#제출 시각아이디문제언어결과실행 시간메모리
198772AkashiVision Program (IOI19_vision)C++14
44 / 100
33 ms3188 KiB
#include <bits/stdc++.h>
#include "vision.h"
 
using namespace std;
 
bool viz[205][205], cul[205][205];
int wh[205][205];
 
void construct_network(int H, int W, int K) {
	vector <int> v;
 
	for(int i = 0 ; i < H ; ++i){
		for(int j = 0; j < W ; ++j){
			if(cul[i][j]) continue ;
			for(int x = -K; x <= K ; ++x){
				int y = K - abs(x);
			
				int l = i + x, c = j + y; 
				if(l >= 0 && c >= 0 && l < H && c < W) cul[l][c] = 1;
			
				y = -y; l = i + x, c = j + y; 
				if(l >= 0 && c >= 0 && l < H && c < W) cul[l][c] = 1;
				
			}
		}
	}
 
	int Last = 0;
	for(int i = 0; i < H ; ++i){
		for(int j = 0; j < W ; ++j){
			if(!cul[i][j]) continue ;
			viz[i][j] = 1;
			v.clear();
	
			for(int x = -K; x <= K ; ++x){
				int y = K - abs(x);
				int l = i + x, c = j + y; 
		
				if(l >= 0 && c >= 0 && l < H && c < W){
					if(!viz[l][c]) v.push_back(l * W + c);
				}
				
				y = -y;
				l = i + x, c = j + y; 
		
				if(l >= 0 && c >= 0 && l < H && c < W){
					if(!viz[l][c]) v.push_back(l * W + c);
				}
			}
	
			if(v.size() == 0) continue ;
			wh[i][j] = add_or(v);
			Last = wh[i][j];
		}
	}
	
	int st = Last + 1, dr = 0;
	for(int i = 0; i < H ; ++i){
		for(int j = 0; j < W ; ++j){
			if(wh[i][j]){
				vector <int> v;
				v.push_back(i * W + j);
				v.push_back(wh[i][j]);
				dr = add_and(v);
			}
		}
	}
	
	v.clear();
	for(int i = st; i <= dr ; ++i) v.push_back(i);
	add_or(v);
 
	return ;
}
#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...