Submission #370355

# Submission time Handle Problem Language Result Execution time Memory
370355 2021-02-23T20:45:48 Z MilosMilutinovic Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
#define pb push_back
const int N=205;
const int M=31;
int h,w,k,a[N][N];
bool was[M][M][M][M];
int Get(int i,int j){return a[i][j];}
void SolveBF(){
	int tmp=0;
	for(int i=0;i<h;i++)for(int j=0;j<w;j++)a[i][j]=tmp++;
	vector<int> ask;
	int cnt=h*w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			for(int x=0;x<h;x++){
				for(int y=0;y<w;y++){
					//if(was[x][y][i][j])continue;
					//was[i][j][x][y]=true;
					int dist=abs(x-i)+abs(y-j);
					if(dist!=k)continue;
					add_and({Get(i,j),Get(x,y)});
					ask.pb(cnt);
					cnt++;
				}
			}
		}
	}
	if((int)ask.size()==0){
		add_not(1);
		return;
	}
	add_or(ask);
}
void SolveEZ(){
	vector<int> ask;
	int cnt=0h*w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			int dist=i+j;
			if(dist!=k)continue;
			add_and({0,Get(i,j)});
			ask.pb(cnt);
			cnt++;
		}
	}
	if((int)ask.size()==0){
		add_not(1);
		return;
	}
	add_or(ask);
}
void construct_network(int H,int W,int K){
	h=H,w=W,k=K;
	if(max(H,W)<=30||min(H,W)==1){
		SolveBF();
		return;
	}else{
		SolveEZ();
	}
}

Compilation message

vision.cpp: In function 'void SolveEZ()':
vision.cpp:38:12: error: cannot convert 'std::chrono::duration<long int, std::ratio<3600> >' to 'int' in initialization
   38 |  int cnt=0h*w;
      |          ~~^~
      |            |
      |            std::chrono::duration<long int, std::ratio<3600> >