Submission #856404

# Submission time Handle Problem Language Result Execution time Memory
856404 2023-10-03T11:59:50 Z Trisanu_Das Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std; 

void construct_network(int h, int w, int k){
  vector<int> ans;
  if(k == 1){
    vector<int> r(h), c(w), ans;
	for (int i = 0; i < h; i++) {
		vector<int> res;
		for (int j = 0; j < w; ++j) res.push_back(i * m + j);
		r[i] = add_or(res);
	}
	for (int j = 0; j < m; j++) {
		vector<int> res;
		for (int i = 0; i < n; i++) res.push_back(i * m + j);
		c[j] = add_or(res);
	}
	int xr = add_xor(r), xc = add_xor(c);
	for (int i = 1; i < h; i++) ans.push_back(add_and({r[i - 1], r[i], xc}));
	for (int i = 1; i < m; i++) ans.push_back(add_and({c[i - 1], c[i], xr}));
    add_or(ans);
  }else{
    vector<int> ans;
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        vector<int> res;
        for(int x = 0; x < h; x++) for(int y = 0; y < w; y++) if(abs(i - x) + abs(j - y) == k) res.push_back(x * w + y);
        if(!res.empty()) ans.push_back(add_and({add_or(res), i * w + j}));
      }
    }
    add_or(ans);
  }
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:11:49: error: 'm' was not declared in this scope
   11 |   for (int j = 0; j < w; ++j) res.push_back(i * m + j);
      |                                                 ^
vision.cpp:14:22: error: 'm' was not declared in this scope
   14 |  for (int j = 0; j < m; j++) {
      |                      ^
vision.cpp:16:23: error: 'n' was not declared in this scope
   16 |   for (int i = 0; i < n; i++) res.push_back(i * m + j);
      |                       ^
vision.cpp:21:22: error: 'm' was not declared in this scope
   21 |  for (int i = 1; i < m; i++) ans.push_back(add_and({c[i - 1], c[i], xr}));
      |                      ^