답안 #892819

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892819 2023-12-26T03:30:13 Z Sir_Ahmed_Imran Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
                              ///~~~LOTA~~~///
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long 
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define N 100001
void construct_network(int n,int m,int k){
    int p,q,r;
    vector<int> u,v;
    for(int i=0;i<n;i++){
        u.clear();
        for(int j=0;j<m;j++)
            u.append(i*m+j);
        if(add_or(u)) v.append(i);
    }
    p=v[0];
    q=v.back();
    if(k<q-p || m>=k-q+p){
        u={0,1,2};
        r=add_and(u);
        if(n+m==3)
            u=add_not(0);
        return;
    }
    for(int i=0;i<m-k+q-p;i++){
        u={p*m+i,q*m+i+k-q+p};
        if(add_and(u)) return;
        u={p*m+i+k-q+p,q*m+i};
        if(add_and(u)) return;
    }
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:28:24: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
   28 |             u=add_not(0);
      |                        ^
In file included from /usr/include/c++/10/vector:72,
                 from vision.h:5,
                 from vision.cpp:2:
/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 'int' 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:2:
/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 'int' 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 'int' to 'std::initializer_list<int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~