Submission #892858

# Submission time Handle Problem Language Result Execution time Memory
892858 2023-12-26T05:49:15 Z Muhammad_Aneeq Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include <vector>
#include <map>
using namespace std;
int h,w;
int ind;
map<pair<int,int>,bool>d;
void check(int i,int j,int k,int l)
{
	if (i<0||i>=h||j<0||j>=w)
		return;
	int x=i*h+w;
	if (d[{x,k*h+l}]==1)
		return;
	d[{x,k*h+l}]=d[{k*h+l,x}]=1;
	add_and({x,k*h+l});
	ind++;
}
void check1(vector<int>z)
{
	vector<int>ans;
	for (int i=0;i<=(z.size()-1)/10000;i++)
	{
		vector<int>temp;
		ans.push_back(ind++);
		for (int j=10000*i;j<min(int(z.size()),((i+1)*10000));j++)
			temp.push_back(z[j]);
		add_or(temp);
	}
	add_or(ans);
}
void construct_network(int H,int W,int K)
{
	h=H;w=W;
	ind = H*W;
	for (int i=0;i<H;i++)
		for (int j=0;j<W;j++)
			for (int k=0;k<=K;k++)
			{
				check(i+k,j+K-k,i,j);check(i+k,j-K+k,i,j);check(i-k,j-K+k,i,j);check(i-k,j+K-k,i,j);
			}
	vector<int>z;
	for (int i=H*W;i<ind;i++)
		z.push_back(i);
}

Compilation message

vision.cpp: In function 'void check(int, int, int, int)':
vision.cpp:15:2: error: 'add_and' was not declared in this scope
   15 |  add_and({x,k*h+l});
      |  ^~~~~~~
vision.cpp: In function 'void check1(std::vector<int>)':
vision.cpp:21:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int i=0;i<=(z.size()-1)/10000;i++)
      |               ~^~~~~~~~~~~~~~~~~~~~
vision.cpp:27:3: error: 'add_or' was not declared in this scope
   27 |   add_or(temp);
      |   ^~~~~~
vision.cpp:29:2: error: 'add_or' was not declared in this scope
   29 |  add_or(ans);
      |  ^~~~~~