답안 #612719

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
612719 2022-07-29T22:16:26 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;
}

bool is(int i, int j){
	if(i < 0 || i >= H || j < 0 || j >= W) return false;
	return true;
}

void construct_network(int H, int W, int K) {
	int cap = 1; int last = 0;

	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){
						last = add_and({f(i, j), f(k, l)});
						cap++;
					}
				}
			}
		}
	}

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

	add_or(v);
}

Compilation message

vision.cpp: In function 'bool is(int, int)':
vision.cpp:10:19: error: 'H' was not declared in this scope
   10 |  if(i < 0 || i >= H || j < 0 || j >= W) return false;
      |                   ^
vision.cpp:10:38: error: 'W' was not declared in this scope
   10 |  if(i < 0 || i >= H || j < 0 || j >= W) return false;
      |                                      ^
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:22:29: error: too few arguments to function 'int f(int, int, int)'
   22 |       last = add_and({f(i, j), f(k, l)});
      |                             ^
vision.cpp:5:5: note: declared here
    5 | int f(int i, int j, int W){
      |     ^
vision.cpp:22:38: error: too few arguments to function 'int f(int, int, int)'
   22 |       last = add_and({f(i, j), f(k, l)});
      |                                      ^
vision.cpp:5:5: note: declared here
    5 | int f(int i, int j, int W){
      |     ^
vision.cpp:22:40: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   22 |       last = add_and({f(i, j), f(k, l)});
      |                                        ^
      |                                        |
      |                                        <brace-enclosed initializer list>