Submission #1090425

# Submission time Handle Problem Language Result Execution time Memory
1090425 2024-09-18T10:55:35 Z vjudge1 Game (IOI13_game) C++17
Compilation error
0 ms 0 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<long long int>st[101];
void init(int R,int C)
{
    n=R;
    m=C;
    for(int i=0;i<n;i++)
    {
        st[i].resize(4*m+1);
    }
}
void updatest(int i,int l,int r,int a,int b,long long int k)
{
    if(l==r)
    {
        st[a][i]=k;
        return;
    }
    int m=(l+r)/2;
    if(b<=m)updatest(i*2,l,m,a,b,k);
    else
    {
        updatest(i*2+1,m+1,r,a,b,k);
    }
    st[i]=gcd(st[a][i*2],st[a][i*2+1]);
}
long long int gsum(int i,int l,int r,int tl,int tr,int a)
{
    if(tl>r||tr<l||l>r)
    {
        return 0;
    }
    if(tl<=l&&r<=tr)
    {
        return st[a][i];
    }
    int m=(l+r)/2;
    return gcd(gsum(i*2,l,m,tl,tr,a),gsum(i*2+1,m+1,r,tl,tr,a));
}
long long int calculate(int r1,int r2,int c1,int c2)
{
    long long int sum=0;
    for(int i=r1;i<=c1;i++)
    {
        sum=gcd(sum,gsum(1,0,m-1,r2,c2,i));
    }
    return sum;
}
void update(int R,int C,long long int k)
{
      updatest(1,0,m-1,R,C,k);
}

Compilation message

game.cpp: In function 'void updatest(int, int, int, int, int, long long int)':
game.cpp:28:38: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::common_type_t<long long int, long long int>' {aka 'long long int'})
   28 |     st[i]=gcd(st[a][i*2],st[a][i*2+1]);
      |                                      ^
In file included from /usr/include/c++/10/vector:72,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from game.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 = 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::common_type_t<long long int, long long int>' {aka 'long long 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 /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from game.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 = 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::common_type_t<long long int, long long int>' {aka 'long long 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::common_type_t<long long int, long long int>' {aka 'long long int'} to 'std::initializer_list<long long int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~