답안 #892813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892813 2023-12-26T03:11:36 Z Faisal_Saqib Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
#include <vector>
#include <string>
using namespace std;

int add_and(std::vector<int> Ns);

int add_or(std::vector<int> Ns);

int add_xor(std::vector<int> Ns);

int add_not(int N);
bool vis[202][202];
int k,h,w;
int f(int i,int j)
{
	return (i*w)+j;
}
int val=-1;
int px=-1,py=-1;
void dfs(int i,int j)
{
	// cout<<"At "<<i<<' '<<j<<endl;
	vis[i][j]=1;
	int ox=px;
	int oy=py;
	px=i;
	py=j;
	for(int fp=-k;fp<=k;fp++)
	{
		int rem=k-abs(fp);
		if(0<=(i+fp) and (i+fp)<h and 0<=(j+rem) and (j+rem)<w and (px!=(i+fp) or py!=(j+rem)))
		{
			if(val==-1)
				val=add_and({f(i,j),f(i+fp,j+rem)});
			else
				val=add_or(val,add_and({f(i,j),f(i+fp,j+rem)}));
			if(!vis[i+fp][j+rem])
				dfs(i+fp,j+rem);
		}
		rem*=-1;
		if(0<=(i+fp) and (i+fp)<h and 0<=(j+rem) and (j+rem)<w and (px!=(i+fp) or py!=(j+rem)))
		{
			if(val==-1)
				val=add_and({f(i,j),f(i+fp,j+rem)});
			else
				val=add_or(val,add_and({f(i,j),f(i+fp,j+rem)}));
			if(!vis[i+fp][j+rem])
				dfs(i+fp,j+rem);
		}
	}
	px=ox;
	py=oy;
}
void construct_network(int H, int W, int K)
{
	k=K;
	h=H;
	w=W;
	for(int i=0;i<H;i++)
	{
		for(int j=0;j<W;j++)
		{
			if(!vis[i][j])
			{
				dfs(i,j);
			}
		}
	}
}

Compilation message

vision.cpp: In function 'void dfs(int, int)':
vision.cpp:36:16: error: could not convert 'val' from 'int' to 'std::vector<int>'
   36 |     val=add_or(val,add_and({f(i,j),f(i+fp,j+rem)}));
      |                ^~~
      |                |
      |                int
vision.cpp:46:16: error: could not convert 'val' from 'int' to 'std::vector<int>'
   46 |     val=add_or(val,add_and({f(i,j),f(i+fp,j+rem)}));
      |                ^~~
      |                |
      |                int