답안 #612721

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
612721 2022-07-29T22:24:41 Z morete Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#include "vision.h"

int f(int i, int j, int W){
	return i*W + j;
}

void construct_network(int H, int W, int K) {
	int cap = 1; int last = 0;
	map<array<int, 4>> M;
	for(int i = 0; i < H && cap < 10000; i++){
		for(int j = 0; j < W && cap < 10000; j++){
			for(int k = 0; k < H && cap < 10000; k++){
				for(int l = 0; l < W && cap < 10000; l++){
					if(abs(i - k) + abs(j - l) == K && !M.count({i, j, k, l})){
						last = add_and({f(i, j, W), f(k, l, W)});
						cap++;
						M[{i, j, k, l}] = true;
						M[{k, l, i, j}] = true;
					}
				}
			}
		}
	}

	vector<int> v;
	for(int i = H*W; i <= last; i++) v.push_back(i);

	add_or(v);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:11:18: error: wrong number of template arguments (1, should be at least 2)
   11 |  map<array<int, 4>> M;
      |                  ^~
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_map.h:100:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  100 |     class map
      |           ^~~
vision.cpp:16:44: error: request for member 'count' in 'M', which is of non-class type 'int'
   16 |      if(abs(i - k) + abs(j - l) == K && !M.count({i, j, k, l})){
      |                                            ^~~~~
vision.cpp:19:8: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   19 |       M[{i, j, k, l}] = true;
      |        ^
vision.cpp:20:8: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   20 |       M[{k, l, i, j}] = true;
      |        ^