Submission #400972

#TimeUsernameProblemLanguageResultExecution timeMemory
400972zoooma13비스킷 담기 (IOI20_biscuits)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
#include "biscuits.h"
using namespace std;

vector <int64_t> a;
int64_t dp[2][64];
int64_t go(int i ,bool o){
    if(i == a.size())
        return 1;
    auto&ret = dp[o][i];
    if(~ret)
        return ret;
    if(!o && a[i] == 0) return ret = go(i+1 ,0);
    if(!o && a[i] == 1) return ret = 2*go(i+1 ,0);
    if(!o && a[i] == 2) return ret = 2*go(i+1 ,0) + go(i+1 ,1);
    if(o && a[i] == 0)  return ret = 2*go(i+1 ,0);
    if(o && a[i] == 1)  return ret = 2*go(i+1 ,0) + go(i+1 ,1);
    if(o && a[i] == 2)  return ret = 2*go(i+1 ,0) + 2*go(i+1 ,1);
}

long long count_tastiness(long long x, vector<long long> _a) {
    assert(x == 1);
    int64_t bef = 0;
    a = _a;
    a.resize(62);
    for(auto&i : a){
        i += bef;
        bef = (i-1)/2;
        i -= 2*bef;
    }
    memset(dp ,-1 ,sizeof dp);
    return go(0 ,0);
}

Compilation message (stderr)

biscuits.cpp: In function 'int64_t go(int, bool)':
biscuits.cpp:8:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     if(i == a.size())
      |        ~~^~~~~~~~~~~
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:24:9: error: no match for 'operator=' (operand types are 'std::vector<long int>' and 'std::vector<long long int>')
   24 |     a = _a;
      |         ^~
In file included from /usr/include/c++/9/vector:72,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from biscuits.cpp:1:
/usr/include/c++/9/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<long int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from biscuits.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:706:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  706 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:706:26: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<long int>&&'
  706 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_vector.h:727:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  727 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:727:46: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<long int>'
  727 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
biscuits.cpp: In function 'int64_t go(int, bool)':
biscuits.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^