Submission #502722

#TimeUsernameProblemLanguageResultExecution timeMemory
502722wind_reaperVision Program (IOI19_vision)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "vision.h"

using namespace std;

int check(int H, int W, int K){
	vector<int> add[401], sub[401];
	
	for(int i = 0; i < H; i++)
		for(int j = 0; j < W; j++){
			add[i+j].push_back(i*W + j);
			sub[i - j + W - 1].push_back(i*W + j);
		}
	
	vector<int> xadd, pxadd, xsub, pxsub, res;
	
	for(int d = 0; d < H + W - 2; d++){
		xadd.push_back(add_xor(add[d]));
		pxadd.push_back(add_xor(xadd));
		
		xsub.push_back(add_xor(sub[d]));
		pxsub.push_back(add_xor(xsub));
		
		if(d >= K){
			res.push_back(add_and(xadd[d], pxadd[d-K]));
			res.push_back(add_and(xsub[d], pxsub[d-K]));
		}
	}
	
	return add_or(res);
}

void construct_network(int H, int W, int K){
	if(K == H + W - 2) add_xor(check(H, W, K));
	else add_xor(check(H, W, K), check(H, W, K + 1));
}

Compilation message (stderr)

vision.cpp: In function 'int check(int, int, int)':
vision.cpp:25:45: error: could not convert 'xadd.std::vector<int>::operator[](((std::vector<int>::size_type)d))' from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>'
   25 |    res.push_back(add_and(xadd[d], pxadd[d-K]));
      |                                             ^
      |                                             |
      |                                             __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:26:45: error: could not convert 'xsub.std::vector<int>::operator[](((std::vector<int>::size_type)d))' from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>'
   26 |    res.push_back(add_and(xsub[d], pxsub[d-K]));
      |                                             ^
      |                                             |
      |                                             __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:34:34: error: could not convert 'check(H, W, K)' from 'int' to 'std::vector<int>'
   34 |  if(K == H + W - 2) add_xor(check(H, W, K));
      |                             ~~~~~^~~~~~~~~
      |                                  |
      |                                  int
vision.cpp:35:20: error: could not convert 'check(H, W, K)' from 'int' to 'std::vector<int>'
   35 |  else add_xor(check(H, W, K), check(H, W, K + 1));
      |               ~~~~~^~~~~~~~~
      |                    |
      |                    int