답안 #429504

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
429504 2021-06-16T04:25:04 Z lakshith_ Vision Program (IOI19_vision) C++14
14 / 100
20 ms 2392 KB
#include "vision.h"
#include <bits/stdc++.h>

#define checker(a) cout << "checker reached " << a << "\n"

using namespace std;

int h,w;

int getPos(int x,int y){
	return x*w+y;
}

int getDis(pair<int,int> p1,pair<int,int> p2){
	return abs(p1.first-p2.first)+abs(p1.second-p2.second);
}

void construct_network(int H, int W, int k) {
	h=H,w=W;
	vector<vector<int>> ro,col;
	for(int i=0;i<h;i++){
		ro.push_back(vector<int>());
		for(int j=0;j<w;j++)
			ro[i].push_back(getPos(i,j));
	}
	for(int i=0;i<w;i++){
		col.push_back(vector<int>());
		for(int j=0;j<h;j++)
			col[i].push_back(getPos(j,i));
	}
	
	vector<int> Xor;
	for(vector<int> vec:ro)
		Xor.push_back(add_xor(vec));
	for(vector<int> vec:col)
		Xor.push_back(add_xor(vec));
	
	vector<int> Not;
	for(int a:Xor)
		Not.push_back(add_not(a));
	Xor.clear();
	
	vector<int> Or,close;
	for(vector<int> vec:ro)
		Or.push_back(add_or(vec));

	for(vector<int> vec:col)
		Or.push_back(add_or(vec));
	
	vector<int> And;
	for(size_t i=0;i<Or.size();i++)
		And.push_back(add_and((vector<int>){Or[i],Not[i]}));
	
	for(size_t i=0;i<h-1;i++){
		close.push_back(add_and((vector<int>){Or[i],Or[i+1]}));
	}
	for(size_t i=h;i<Or.size()-1;i++){
		close.push_back(add_and((vector<int>){Or[i],Or[i+1]}));
	}

		
	int p1 = add_or(And);
	int p2 = add_or(close);
	add_and((vector<int>){p1,p2});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:54:18: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   54 |  for(size_t i=0;i<h-1;i++){
      |                 ~^~~~
# 결과 실행 시간 메모리 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 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 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 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 1 ms 332 KB Output is correct
2 Incorrect 1 ms 332 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 20 ms 2392 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 460 KB Output is correct
4 Correct 4 ms 588 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 11 ms 1356 KB Output is correct
8 Correct 10 ms 1356 KB Output is correct
9 Correct 20 ms 2332 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 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -