답안 #430076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
430076 2021-06-16T11:19:50 Z Hazem Vision Program (IOI19_vision) C++14
26 / 100
10 ms 1100 KB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

void solvefor1(int H,int W,int K){
	
	int cnt = 0;
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			for(int i1=0;i1<H;i1++)
				for(int j1=0;j1<W;j1++)
					if(abs(i-i1)+abs(j-j1)==K){
						vector<int>vec;
						vec.push_back(i*W+j);
						vec.push_back(i1*W+j1);
						add_and(vec);
						cnt++;
					}
 
	vector<int>vec;
	for(int i=H*W;i<H*W+cnt;i++)
		vec.push_back(i);
	add_or(vec);
}

void construct_network(int H, int W, int K) {

	if(H==1||W==1){
		solvefor1(H,W,K);
		return ;
	}

	int cnt = W*H;
	for(int i=0;i<H;i++){
		vector<int>vec;
		for(int j=0;j<W;j++)
			vec.push_back(i*W+j);
		add_or(vec);
		cnt++;
	}	

	for(int i=0;i<H-1;i++){
		vector<int>vec;
		vec.push_back(H*W+i);
		vec.push_back(H*W+i+1);
		add_and(vec);
		cnt++;
	}
	
	vector<int>vec1;
	for(int i=0;i<H-1;i++)
		vec1.push_back(H*W+H+i);
	add_or(vec1);cnt++;
	vec1.clear();

	for(int i=0;i<W;i++){
		vector<int>vec;
		for(int j=0;j<H;j++)
			vec.push_back(j*W+i);
		add_or(vec);
		cnt++;
	}

	for(int i=0;i<W-1;i++){
		vector<int>vec;
		vec.push_back(H*W+H*2+i);
		vec.push_back(H*W+H*2+i+1);
		add_and(vec);
		cnt++;
	}	

	for(int i=0;i<W-1;i++)
		vec1.push_back(H*W+H*2+W+i);
	add_or(vec1);cnt++;
	vec1.clear();

	for(int i=0;i<H;i++)
		vec1.push_back(H*W+i);
	add_xor(vec1);
	
	vec1.clear();
	for(int i=0;i<W;i++)
		vec1.push_back(H*W+H*2+i);
	add_xor(vec1);vec1.clear();

	vec1.push_back(H*W+2*H+2*W);
	vec1.push_back(H*W+2*H+W+W-1);
	add_and(vec1);
	vec1.clear();


	vec1.push_back(H*W+2*H+2*W+1);
	vec1.push_back(H*W+2*H-1);
	add_and(vec1);
	vec1.clear();

	vec1.push_back(H*W+2*H+2*W+2);
	vec1.push_back(H*W+2*H+2*W+3);
	add_or(vec1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 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 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 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 1 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 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 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 1 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 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 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 1 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 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 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 1 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 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 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 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1100 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 6 ms 716 KB Output is correct
8 Correct 5 ms 716 KB Output is correct
9 Correct 10 ms 1100 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 1 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 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 Halted 0 ms 0 KB -