Submission #815323

# Submission time Handle Problem Language Result Execution time Memory
815323 2023-08-08T14:10:40 Z PagodePaiva Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include "vision.h"
#include<bits/stdc++.h>
#define fr first
#define sc second

using namespace std;

int dist(pair <int,int>a,pair<int,int>b){
	return abs(a.fr-b.fr)+abs(a.sc-b.sc);
}

void construct_network(int H, int W, int K) {
	// std::vector<int> Ns;
	// Ns = {0, 1};
	// int a = add_and(Ns);
	// Ns = {0, a};
	// int b = add_or(Ns);
	// Ns = {0, 1, b};
	// int c = add_xor(Ns);
	// add_not(c);

	int n = H, m = W, k = K;
	int r = n*m;

			for(int i1 = 0;i1 < n;i1++){
				for(int j1 = 0;j1 < m;j1++){
					if(dist({0, 0}, {i1, j1}) == k){
						r = add_and({i*m+j, i1*m+j1});
					}
				}
			}

	vector <int> aux;

	for(int i = n*m;i <= r;i++){
		aux.push_back(i);
	}	

	add_or(aux);

	return;
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:28:20: error: 'i' was not declared in this scope; did you mean 'i1'?
   28 |       r = add_and({i*m+j, i1*m+j1});
      |                    ^
      |                    i1
vision.cpp:28:24: error: 'j' was not declared in this scope; did you mean 'j1'?
   28 |       r = add_and({i*m+j, i1*m+j1});
      |                        ^
      |                        j1
vision.cpp:28:35: error: could not convert '{<expression error>, ((i1 * m) + j1)}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   28 |       r = add_and({i*m+j, i1*m+j1});
      |                                   ^
      |                                   |
      |                                   <brace-enclosed initializer list>