답안 #865618

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865618 2023-10-24T12:30:59 Z Lib Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "vision.h"

void construct_network(int H, int W, int K){
	vector <int> RowHasBlack;
	vector <int> ColumnHasBlack;
	vector <int> temp;
	for(int i=0;i<H;i++){
		temp.clear();
		for(int k=0;k<W;k++){
			temp.push_back(i*W+k);
		}
		if(add_or(temp)){
			RowHasBlack.push_back(i);
		}
	}
	for(int i=0;i<W;i++){
		temp.clear();
		for(int k=0;k<H;k++){
			temp.push_back(k*W+i);
		}
		if(add_or(temp)){
			ColumnHasBlack.push_back(i);
		}
	}
	if(RowHasBlack.size()==2&&ColumnHasBlack.size()==2){
		return ( (RowHasBlack[1]-RowHasBlack[0])  + (ColumnHasBlack[1]-ColumnHasBlack[0]==K) );
	}else{
		return 0;
	}
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:5:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    5 |  vector <int> RowHasBlack;
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
vision.cpp:5:10: error: expected primary-expression before 'int'
    5 |  vector <int> RowHasBlack;
      |          ^~~
vision.cpp:6:10: error: expected primary-expression before 'int'
    6 |  vector <int> ColumnHasBlack;
      |          ^~~
vision.cpp:7:10: error: expected primary-expression before 'int'
    7 |  vector <int> temp;
      |          ^~~
vision.cpp:9:3: error: 'temp' was not declared in this scope
    9 |   temp.clear();
      |   ^~~~
vision.cpp:14:4: error: 'RowHasBlack' was not declared in this scope
   14 |    RowHasBlack.push_back(i);
      |    ^~~~~~~~~~~
vision.cpp:18:3: error: 'temp' was not declared in this scope
   18 |   temp.clear();
      |   ^~~~
vision.cpp:23:4: error: 'ColumnHasBlack' was not declared in this scope
   23 |    ColumnHasBlack.push_back(i);
      |    ^~~~~~~~~~~~~~
vision.cpp:26:5: error: 'RowHasBlack' was not declared in this scope
   26 |  if(RowHasBlack.size()==2&&ColumnHasBlack.size()==2){
      |     ^~~~~~~~~~~
vision.cpp:26:28: error: 'ColumnHasBlack' was not declared in this scope
   26 |  if(RowHasBlack.size()==2&&ColumnHasBlack.size()==2){
      |                            ^~~~~~~~~~~~~~
vision.cpp:29:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   29 |   return 0;
      |          ^