Submission #1369989

#TimeUsernameProblemLanguageResultExecution timeMemory
1369989eyadoozRelativnost (COCI15_relativnost)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define endl '\n'
#define mod 10007
#define int long long

const int N=(1ll<<17);
vector<int> tree[2*N];
int fasd=0;
void merg(vector<int>* a, vector<int>* b) {
    if(a->empty()) a->resize(22, 0), (*a)[0]=1;
    if(b->empty()) b->resize(22, 0), (*b)[0]=1;
    for(int i = 0;i <= 21;i++) {
        for(int j=0;j<= 21;j++) {
            tree[fasd][min(21ll, i+j)]+=((*a)[i]*(*b)[j])%mod;
            tree[fasd][min(21ll, i+j)]%=mod;
        }
    }
}
void update(int x, int y, int j) {
    x+=N;
    tree[x].resize(22, 0);
    tree[x][0]=j, tree[x][1]=y;
    while(x>1) {
        x/=2;
        fasd=x;
        tree[x]=merg(&tree[2*x], &tree[2*x+1]);
    }
}
main()
{
    cin.tie(0) -> sync_with_stdio(0);

    int n, c;
    cin >> n >> c;
    int a[n+1]={}, b[n+1]={};
    for(int i=1;i <= n;i++) cin >> a[i];
    for(int i=1;i <= n;i++) cin >> b[i];
    for(int i = 1;i <= n;i++) update(i, a[i]%mod, b[i]%mod);
    int q;
    cin >> q;
    while(q--) {
        int p;
        cin >> p;
        int x, y;
        cin >> x >> y;
        a[p]=x, b[p]=y;
        update(p, x, y);
        vector<int> s=tree[1];
        int ans=0;
        for(int i=c;i<=21;i++) ans+=s[i]%mod, ans%=mod;
        cout << ans << endl;
    }
}
    

Compilation message (stderr)

relativnost.cpp: In function 'void update(long long int, long long int, long long int)':
relativnost.cpp:35:46: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'void')
   35 |         tree[x]=merg(&tree[2*x], &tree[2*x+1]);
      |                                              ^
In file included from /usr/include/c++/13/vector:72,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from relativnost.cpp:1:
/usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: 'constexpr 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>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'void' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/13/vector:66:
/usr/include/c++/13/bits/stl_vector.h:766:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'void' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:788:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'void' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
relativnost.cpp: At global scope:
relativnost.cpp:38:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   38 | main()
      | ^~~~