# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1063636 | aaaaaarroz | Vision Program (IOI19_vision) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
bool limites(int x, int y, int h, int w){
return x>=0&&x<h&&y>=0&&y<w;
}
void construct_network(int H, int W, int K) {
map<pair<int,int>,int>numero;
int pos=1;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
numero[{i,j}]=pos;
pos++;
}
}
vector<int>dx,dy;
for(int restar=0;restar<=K;restar++){
int c_x=restar;
int c_y=K-restar;
dx.push_back(c_x);
dy.push_back(c_y);
dx.push_back(-c_x);
dy.push_back(c_y);
dx.push_back(c_x);
dy.push_back(-c_y);
dx.push_back(-c_x);
dy.push_back(-c_y);
}
map<pair<pair<int,int>,pair<int,int>>,bool>marked;
int cnt=1;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
for(int itr=0;itr<dx.size();itr++){
int x=i+dx[itr];
int y=j+dy[itr];
if(limites(x,y,H,W)){
if(!marked[{{i,j},{x,y}}]){
and_add({numero[{i,j}],numero[{x,y}]});
cnt++;
}
}
}
}
}
vector<int>instruct;
for(int i=H*W+1;i<=(H*W+cnt);i++){
instruct.push_back(i);
}
add_or(instruct);
return;
}