Submission #1018773

# Submission time Handle Problem Language Result Execution time Memory
1018773 2024-07-10T09:38:40 Z vjudge1 The Big Prize (IOI17_prize) C++17
Compilation error
0 ms 0 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
#define lli long long int


int find_best(int n){
    vector<lli>a(2);
    int x=1,y=n,z;
    while(x!=y){
        z=(x+y)/2;
        a=ask(z);
        if(a[0]){
            y=z-1;
        }
        else if(a[1]){
            x=z+1;
        }
        else{
            return z;
        }
    }
    return x;
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:12:16: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   12 |         a=ask(z);
      |                ^
In file included from /usr/include/c++/10/vector:72,
                 from prize.h:1,
                 from prize.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 = long long int; _Alloc = std::allocator<long long int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/vector:67,
                 from prize.h:1,
                 from prize.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 = long long int; _Alloc = std::allocator<long long 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 'std::vector<int>' to 'std::vector<long long 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 = long long int; _Alloc = std::allocator<long long 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 'std::vector<int>' to 'std::initializer_list<long long int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~