답안 #922429

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
922429 2024-02-05T13:55:42 Z ttamx 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) {
	vector<int> res;
  	for(int xi=0;xi<H;xi++){
    	for(int yi=0;yi<W;yi++){
        	for(int xj=0;x<=xi;xj++){
            	for(int yj=0;yj<=yi;yj++){
                	if(xi-xj+yi-yj==K){
                    	res.push_back({xi*W+yi,xj*W+yj});
                    }
				}
            }
        }
    }
 	add_or(res);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:10:23: error: 'x' was not declared in this scope; did you mean 'xj'?
   10 |          for(int xj=0;x<=xi;xj++){
      |                       ^
      |                       xj
vision.cpp:13:53: error: no matching function for call to 'std::vector<int>::push_back(<brace-enclosed initializer list>)'
   13 |                      res.push_back({xi*W+yi,xj*W+yj});
      |                                                     ^
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:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~