QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#507858#8335. Fast Hash Transformucup-team2307#Compile Error//C++203.2kb2024-08-06 21:47:492024-08-06 21:47:49

Judging History

你现在查看的是最新测评结果

  • [2024-08-06 21:47:49]
  • 评测
  • [2024-08-06 21:47:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull=unsigned long long;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using pii = pair<int, int>;
using vi = vector<int>;
#define fi first
#define se second
#define pb push_back

const int L=64;

using row=bitset<L+1>;
using matr=array<row,L+1>;

constexpr matr UNIT()
{
    matr res={};
    for(int i=0;i<=L;i++)
        res[i][i]=true;
    return res;
}

matr mul(const matr& l,const matr& r)
{
    matr R;
    for(int i=0;i<=L;i++)
        for(int j=0;j<=L;j++)
            R[i][j] = r[j][i];
    matr res={};
    for(int i=0;i<=L;i++)
        for(int j=0;j<=L;j++)
        {
            res[i][k] = (l[i]&R[j]).count()&1;
        }
    return res;
}

void print(matr m)
{
    for(int i=0;i<=L;i++,cout<<"\n")
        for(int j=0;j<=L;j++)
            cout<<m[i][j];
    cout<<"\n";
}

matr read()
{
    matr res={};
    res[L][L]=true;
//    cout<<"read start"<<endl;
    int m;
    cin>>m;
    while(m--)
    {
        int s,o;
        ull a;
        cin>>s>>o>>a;
        for(int i=0;i<L;i++)
        {
            int j=(i+s)%L;
            if(o==0)
            {
                if((a>>j)&1)
                    res[L][j].flip();
                else
                    res[i][j].flip();
            }
            else
            {
                if((a>>j)&1)
                    res[i][j].flip();
            }
        }
    }
    ull b;
    cin>>b;
    for(int i=0;i<L;i++)
        if((b>>i)&1)
            res[L][i]^=1;
//    cout<<"read end"<<endl;
//    print(res);
    return res;
}

static T unit = UNIT();
struct Tree {
    typedef matr T;
    T f(const T& a, const T& b) { return mul(a,b); } // (any associative fn)
    vector<T> s; int n;
    Tree(int n = 0, T def = unit) : s(2*n, def), n(n) {}
    void update(int pos, const T& val) {
        for (s[pos += n] = val; pos /= 2;)
            s[pos] = f(s[pos * 2], s[pos * 2 + 1]);
    }
    T query(int b, int e) { // query [b, e)
        T ra = unit, rb = unit;
        for (b += n, e += n; b < e; b /= 2, e /= 2) {
            if (b % 2) ra = f(ra, s[b++]);
            if (e % 2) rb = f(s[--e], rb);
        }
        return f(ra, rb);
    }
};

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);

    int n,q,c;
    cin>>n>>q>>c;
    Tree tree(n);
    for(int i=0;i<n;i++)
        tree.update(i,read());
    while(q--)
    {
        int op;
        cin>>op;
        if(op==0)
        {
            int l,r;
            ull x;
            cin>>l>>r>>x;
            matr m=tree.query(l-1,r);
//            print(m);
            ull res=0;
            for(int i=0;i<L;i++)
                for(int j=0;j<L;j++)
                    if(m[i][j]&&((x>>i)&1))
                        res^=1ULL<<j;
            for(int j=0;j<L;j++)
                if(m[L][j])
                    res^=1ULL<<j;
            cout<<res<<"\n";
        }
        else
        {
            int l;
            cin>>l;
            tree.update(l-1,read());
        }
    }
}

Details

answer.code: In function ‘matr mul(const matr&, const matr&)’:
answer.code:38:20: error: ‘k’ was not declared in this scope
   38 |             res[i][k] = (l[i]&R[j]).count()&1;
      |                    ^
answer.code: In function ‘matr read()’:
answer.code:84:22: error: no match for ‘operator^=’ (operand types are ‘std::bitset<65>::reference’ and ‘int’)
   84 |             res[L][i]^=1;
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:176,
                 from answer.code:1:
/usr/include/c++/13/future:182:18: note: candidate: ‘std::launch& std::operator^=(launch&, launch)’
  182 |   inline launch& operator^=(launch& __x, launch __y) noexcept
      |                  ^~~~~~~~
/usr/include/c++/13/future:182:37: note:   no known conversion for argument 1 from ‘std::bitset<65>::reference’ to ‘std::launch&’
  182 |   inline launch& operator^=(launch& __x, launch __y) noexcept
      |                             ~~~~~~~~^~~
In file included from /usr/include/c++/13/format:39,
                 from /usr/include/c++/13/bits/chrono_io.h:39,
                 from /usr/include/c++/13/chrono:3330,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:172:
/usr/include/c++/13/charconv:665:3: note: candidate: ‘constexpr std::chars_format& std::operator^=(chars_format&, chars_format)’
  665 |   operator^=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/13/charconv:665:28: note:   no known conversion for argument 1 from ‘std::bitset<65>::reference’ to ‘std::chars_format&’
  665 |   operator^=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/13/streambuf:43,
                 from /usr/include/c++/13/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/13/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:54:
/usr/include/c++/13/bits/ios_base.h:190:3: note: candidate: ‘const std::_Ios_Iostate& std::operator^=(_Ios_Iostate&, _Ios_Iostate)’
  190 |   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |   ^~~~~~~~
/usr/include/c++/13/bits/ios_base.h:190:28: note:   no known conversion for argument 1 from ‘std::bitset<65>::reference’ to ‘std::_Ios_Iostate&’
  190 |   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |              ~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/ios_base.h:150:3: note: candidate: ‘const std::_Ios_Openmode& std::operator^=(_Ios_Openmode&, _Ios_Openmode)’
  150 |   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |   ^~~~~~~~
/usr/include/c++/13/bits/ios_base.h:150:29: note:   no known conversion for argument 1 from ‘std::bitset<65>::reference’ to ‘std::_Ios_Openmode&’
  150 |   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/ios_base.h:107:3: note: candidate: ‘const std::_Ios_Fmtflags& std::operator^=(_Ios_Fmtflags&, _Ios_Fmtflags)’
  107 |   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |   ^~~~~~~~
/usr/include/c++/13/bits/ios_base.h:107:29: note:   no known conversion for argument 1 from ‘std::bitset<65>::reference’ to ‘std::_Ios_Fmtflags&’
  107 |   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |              ~~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:41:
/usr/include/c++/13/cstddef:177:3: note: candidate: ‘constexpr std::byte& std::operator^=(byte&, byte)’
  177 |   operator^=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/13/cstddef:177:20: note:   no known conversion for argument 1 from ‘std::bitset<65>::reference’ to ‘std::byte&’
  177 |   operator^=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
answer.code: At global scope:
answer.code:90:8: error: ‘T’ does not name a type
   90 | static T unit = UNIT();
      |        ^
answer.code:95:29: error: ‘unit’ was not declared in this scope; did you mean ‘uint’?
   95 |     Tree(int n = 0, T def = unit) : s(2*n, def), n(n) {}
      |                             ^~~~
      |                             uint
answer.code: In member function ‘Tree::T Tree::query(int, int)’:
answer.code:101:16: error: ‘unit’ was not declared in this scope; did you mean ‘uint’?
  101 |         T ra = unit, rb = unit;
      |                ^~~~
      |                uint
answer.code:104:24: error: ‘rb’ was not declared in this scope; did you mean ‘ra’?
  104 |             if (e % 2) rb = f(s[--e], rb);
      |                        ^~
      |                        ra
answer.code:106:22: error: ‘rb’ was not declared in this scope; did you mean ‘ra’?
  106 |         return f(ra, rb);
      |                      ^~
      |                      ra