답안 #166061

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
166061 2019-11-30T13:48:07 Z keta_tsimakuridze Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
 
using namespace std;
#include "vision.h"
vector<int>V;
int ans(){
	return add_or(V);
}
void construct_network(int h, int w, int K){
	vector<int> Dr[405],Dl[405],cur,p,b,a;
	int diag[405],dia[450],k;
	
	
	for(int i=0;i<w;i++)
	for(int j=0;j<h;j++){
		Dr[i-j+h-1].push_back(i*w+j);	
		Dl[i+j].push_back(i*w+j);
	}
	for(int i=w+h-1;i>=0;i--){
		cur.clear();
		cur.push_back(add_or(Dr[i]));
		 p.clear();
		 p.push_back(diag[i+1]);
		diag[i]=add_and({add_or(cur),add_or(p)});
	
		if(i+k<=w+h-1){
			 p.clear();
		 p.push_back(diag[i+k]);
			a=add_and({diag[i+k],add_or(cur)});
			
			
		}
		if(i+k<=w+h-2){
		 p.clear();
		 p.push_back(diag[i+k+1]);
		b=add_and(p,add_and(cur));
	}
		V.push_back(add_xor({b,a}));
		
		
	}
	for(int i=0;i<=w+h-1;i++){
		cur.clear();
		cur.push_back(add_or(Dl[i]));
		 p.clear();
		 p.push_back(dia[i+1]);
		dia[i]=add_and({add_or(cur),add_or(p)});
	
		if(i-k>=0){
			 p.clear();
		 p.push_back(dia[i-k]);
			a=add_and({diag[i-k],add_or(cur)});
			
			
		}
		if(i-k>=1){
		 p.clear();
		 p.push_back(diag[i-k-1]);
		b=add_and({p,add_and(cur)});
	}
		V.push_back(add_xor({b,a}));
		
		
	}
	ans();
}
	
	

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:29:37: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
    a=add_and({diag[i+k],add_or(cur)});
                                     ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/7/bits/vector.tcc:179:5: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:179:5: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:461:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:461:7: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
/usr/include/c++/7/bits/stl_vector.h:482:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(initializer_list<value_type> __l)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:482:7: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
vision.cpp:36:27: error: too many arguments to function 'int add_and(std::vector<int>)'
   b=add_and(p,add_and(cur));
                           ^
In file included from vision.cpp:4:0:
vision.h:10:5: note: declared here
 int add_and(std::vector<int> Ns);
     ^~~~~~~
vision.cpp:36:27: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
   b=add_and(p,add_and(cur));
                           ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/7/bits/vector.tcc:179:5: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:179:5: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:461:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:461:7: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
/usr/include/c++/7/bits/stl_vector.h:482:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(initializer_list<value_type> __l)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:482:7: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
vision.cpp:38:28: error: could not convert '{b, a}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   V.push_back(add_xor({b,a}));
                            ^
vision.cpp:52:37: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
    a=add_and({diag[i-k],add_or(cur)});
                                     ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/7/bits/vector.tcc:179:5: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:179:5: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:461:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:461:7: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
/usr/include/c++/7/bits/stl_vector.h:482:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(initializer_list<value_type> __l)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:482:7: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
vision.cpp:59:29: error: could not convert '{p, add_and(std::vector<int>(cur))}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   b=add_and({p,add_and(cur)});
                             ^
vision.cpp:61:28: error: could not convert '{b, a}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   V.push_back(add_xor({b,a}));
                            ^