QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#577714#9302. Caesar Cipherrotcar07Compile Error//C++202.1kb2024-09-20 14:13:052024-09-20 14:13:09

Judging History

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

  • [2024-11-04 17:10:09]
  • hack成功,自动添加数据
  • (/hack/1110)
  • [2024-10-21 09:47:48]
  • hack成功,自动添加数据
  • (/hack/1022)
  • [2024-10-21 09:39:50]
  • hack成功,自动添加数据
  • (/hack/1021)
  • [2024-10-21 09:31:34]
  • hack成功,自动添加数据
  • (/hack/1020)
  • [2024-10-03 10:14:59]
  • hack成功,自动添加数据
  • (/hack/928)
  • [2024-09-28 07:51:27]
  • hack成功,自动添加数据
  • (/hack/922)
  • [2024-09-28 07:42:39]
  • hack成功,自动添加数据
  • (/hack/921)
  • [2024-09-26 18:56:14]
  • hack成功,自动添加数据
  • (/hack/911)
  • [2024-09-23 07:21:34]
  • hack成功,自动添加数据
  • (/hack/885)
  • [2024-09-20 15:14:45]
  • hack成功,自动添加数据
  • (/hack/855)
  • [2024-09-20 14:21:31]
  • hack成功,自动添加数据
  • (/hack/854)
  • [2024-09-20 14:19:40]
  • hack成功,自动添加数据
  • (/hack/853)
  • [2024-09-20 14:16:01]
  • hack成功,自动添加数据
  • (/hack/851)
  • [2024-09-20 14:13:09]
  • 评测
  • [2024-09-20 14:13:05]
  • 提交

answer

//sbzmc hack me
#include<bits/stdc++.h>
using namespace std;
int n,q;
constexpr int maxn=5e5+5;
int a[maxn];
mt19937 rnd(time(NULL));
typedef unsigned long long ull;
constexpr ull mod=1e9+9,base=rnd()%114514+100000;
int mx[maxn<<2],len[maxn<<2];
ull bs[maxn],sb[maxn],hsh[maxn<<2];
#define ls p<<1
#define rs p<<1|1
int g[maxn<<2];
inline void pushup(int p){
    mx[p]=max(mx[ls],mx[rs]);
    hsh[p]=(hsh[ls]*bs[len[rs]]+hsh[rs])%mod;
}
inline void pd(int p,int x){
    mx[p]+=x,g[p]+=x;
    hsh[p]=(hsh[p]+x*sb[len[p]-1])%mod;
}
inline void pushdown(int p){
    if(g[p]){pd(ls,g[p]),pd(rs,g[p]),g[p]=0;}
}
void build(int p,int l,int r){
    len[p]=r-l+1;
    if(l==r) return mx[p]=hsh[p]=a[l],void();
    int mid=l+r>>1;
    build(ls,l,mid),build(rs,mid+1,r);
    pushup(p);
}
void modify(int p,int l,int r,int ql,int qr){
    if(ql<=l&&r<=qr) return pd(p,1);
    int mid=l+r>>1;
    pushdown(p);
    if(ql<=mid) modify(ls,l,mid,ql,qr);
    if(qr>mid) modify(rs,mid+1,r,ql,qr);
    pushup(p);
}
void assign(int p,int l,int r){
    if(mx[p]<65536) return;
    if(l==r){
        mx[p]=hsh[p]=0;
        return;
    }
    int mid=l+r>>1;
    pushdown(p);
    assign(ls,l,mid),assign(rs,mid+1,r);
    pushup(p);
}
ull res;
void query(int p,int l,int r,int ql,int qr){
    if(ql<=l&&r<=qr){
        res=(res*bs[len[p]]+hsh[p])%mod;
        return;
    }
    int mid=l+r>>1;pushdown(p);
    if(ql<=mid) query(ls,l,mid,ql,qr);
    if(qr>mid) query(rs,mid+1,r,ql,qr);
}
int main(){
    std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>q;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=bs[0]=sb[0]=1;i<=n;i++) bs[i]=bs[i-1]*base%mod,sb[i]=(sb[i-1]*base+1)%mod;
    build(1,1,n);
    while(q--){
        int op,x,y,z;cin>>op>>x>>y;
        if(op==1) modify(1,1,n,x,y),assign(1,1,n);
        else{
            cin>>z;
            ull A,B;
            res=0;query(1,1,n,x,x+z-1);
            A=res,res=0;query(1,1,n,y,y+z-1);
            B=res;
            puts((A==B)?"yes":"no");
        }
        // cout<<hsh[1]<<'\n';
    }
}

详细

answer.code:9:33: error: call to non-‘constexpr’ function ‘std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::operator()() [with _UIntType = long unsigned int; long unsigned int __w = 32; long unsigned int __n = 624; long unsigned int __m = 397; long unsigned int __r = 31; _UIntType __a = 2567483615; long unsigned int __u = 11; _UIntType __d = 4294967295; long unsigned int __s = 7; _UIntType __b = 2636928640; long unsigned int __t = 15; _UIntType __c = 4022730752; long unsigned int __l = 18; _UIntType __f = 1812433253; result_type = long unsigned int]’
    9 | constexpr ull mod=1e9+9,base=rnd()%114514+100000;
      |                              ~~~^~
In file included from /usr/include/c++/13/random:53,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:179,
                 from answer.code:2:
/usr/include/c++/13/bits/random.tcc:453:5: note: ‘std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::operator()() [with _UIntType = long unsigned int; long unsigned int __w = 32; long unsigned int __n = 624; long unsigned int __m = 397; long unsigned int __r = 31; _UIntType __a = 2567483615; long unsigned int __u = 11; _UIntType __d = 4294967295; long unsigned int __s = 7; _UIntType __b = 2636928640; long unsigned int __t = 15; _UIntType __c = 4022730752; long unsigned int __l = 18; _UIntType __f = 1812433253; result_type = long unsigned int]’ declared here
  453 |     mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  454 |                             __s, __b, __t, __c, __l, __f>::
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~