답안 #807117

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
807117 2023-08-04T13:31:41 Z Benmath Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
void construct_network(int H, int W, int K) {
	std::vector<int> Ns;
	int a;
	
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
				for(int k=0;k<H;k++){
					for(int t=0;t<W;t++){
						if((abs(i-k)+abs(j-t))==K){
								Ns= {i*W+j,ro1*W+ro2};
					a=add_and(Ns);
						}
					}
				}
			
				
				
			}
		}
	
	Ns.clear();
	for(int i=H*W;i<=a;i++){
		Ns.push_back(i);
	}
	 a = add_or(Ns);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:13:20: error: 'ro1' was not declared in this scope
   13 |         Ns= {i*W+j,ro1*W+ro2};
      |                    ^~~
vision.cpp:13:26: error: 'ro2' was not declared in this scope
   13 |         Ns= {i*W+j,ro1*W+ro2};
      |                          ^~~
vision.cpp:13:29: error: no match for 'operator=' (operand types are 'std::vector<int>' and '<brace-enclosed initializer list>')
   13 |         Ns= {i*W+j,ro1*W+ro2};
      |                             ^
In file included from /usr/include/c++/10/vector:72,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/vector:67,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~