Submission #283115

# Submission time Handle Problem Language Result Execution time Memory
283115 2020-08-25T10:08:58 Z aymanrs Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <set>
#include <vector>
std::set<std::pair<std::pair<int,int>, std::pair<int, int>>> alreadyTried;
bool valid(int H, int W, int i, int j, int oI, int oJ){
	if(oI < i || (oI == i && oJ < j)){
		if(alreadyTried.find({{oI, oJ}, {i, j}}) != alreadyTried.end()){
			return false;
		} else {
			alreadyTried.insert({{oI, oJ}, {i, j}});
		}
	}  else {
		if(alreadyTried.find({{i, j}, {oI, oJ}}) != alreadyTried.end()){
			return false;
		} else {
			alreadyTried.insert({{i, j}, {oI, oJ}});
		}
	}
	return i >= 0 && i < H && j >= 0 && j < W;
}
void construct_network(int H, int W, int K){
	int ind = H*W;
	for(int i = 0;i < H;i++){
		for(int j = 0;j < W;j++){
			for(int x = -K + 1; x < K;x++){
				int y = K - abs(x);
				if(valid(H, W, i+y, j+x, i, j)){
					add_and({i*W+j, (i+y)*H + (j+x)*W});
					ind++;
				}
				y=-y;
				if(valid(H, W, i+y, j+x, i, j)){
					add_and({i*W+j, (i+y)*H + (j+x)*W});
					ind++;
				}
			}
			if(valid(H, W, i, j+K, i, j)){
				add_and({i*W+j, i*H + (j+K)*W});
				ind++;
			}
			if(valid(H, W, i, j-K, i, j)){
				add_and({i*W+j, i*H + (j-K)*W});
				ind++;
			}
		}
	}
	std::vector<int> vec;
	for(int i = H*W;i < ind;i++){
		vec.push_back(i);
	}
	add_or(vec);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:28:6: error: 'add_and' was not declared in this scope
   28 |      add_and({i*W+j, (i+y)*H + (j+x)*W});
      |      ^~~~~~~
vision.cpp:33:6: error: 'add_and' was not declared in this scope
   33 |      add_and({i*W+j, (i+y)*H + (j+x)*W});
      |      ^~~~~~~
vision.cpp:38:5: error: 'add_and' was not declared in this scope
   38 |     add_and({i*W+j, i*H + (j+K)*W});
      |     ^~~~~~~
vision.cpp:42:5: error: 'add_and' was not declared in this scope
   42 |     add_and({i*W+j, i*H + (j-K)*W});
      |     ^~~~~~~
vision.cpp:51:2: error: 'add_or' was not declared in this scope
   51 |  add_or(vec);
      |  ^~~~~~