QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#634051#8139. Ayano and sequencesLaynCompile Error//C++143.2kb2024-10-12 16:38:062024-10-12 16:38:06

Judging History

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

  • [2024-10-12 16:38:06]
  • 评测
  • [2024-10-12 16:38:06]
  • 提交

answer

#define_FORTIFY_SOURCE0
#pragmaGCCoptimize(”Ofast,no−stack−protector”)
#pragmaGCCtarget(”sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native”)
#include<bits/stdc++.h>
#define mid (l+r>>1)
#define ls l,mid,p<<1
#define rs mid+1,r,p<<1|1
#define mp make_pair
#define rg register
#define il inline
using namespace std;
const int N=500010,inf=1000000000;
int n,m,a[N];
bool flag[N*4];
unsigned long long b[N];
set<pair<int,int> >lft;
struct mat {
    unsigned long long c[3][3];
    il mat(){memset(c,0,sizeof(c));}
}E,t[N*4],tag[N*4];
il int read() {
    int x=0;char ch=getchar();
    while(ch<'0'||ch>'9')ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x;
}
il mat get_m(int w) {
    mat x;
    x.c[0][0]=x.c[1][1]=x.c[1][2]=x.c[2][2]=1;
    x.c[0][1]=x.c[0][2]=w;
    return x;
}
il mat mul(mat x,mat y) {
    mat z;
    for(int i=0;i<3;i++)for(int j=i;j<3;j++)for(int k=i;k<=j;k++)
        z.c[i][j]+=x.c[i][k]*y.c[k][j];
    return z;
}
il void turn(int p,mat w) {t[p]=mul(t[p],w),tag[p]=mul(tag[p],w),flag[p]=1;}
il void pushdown(int p) {turn(p<<1,tag[p]),turn(p<<1|1,tag[p]),tag[p]=E,flag[p]=0;}
 void update(int l,int r,int p,int ql,int qr,int w) {
    if(l>=ql&&r<=qr)return turn(p,get_m(w));
    if(flag[p])pushdown(p);
    if(mid>=ql)update(ls,ql,qr,w);
    if(mid<qr)update(rs,ql,qr,w);
    for(int i=1;i<3;i++)t[p].c[0][i]=t[p<<1].c[0][i]+t[p<<1|1].c[0][i];
}
 unsigned long long query(int l,int r,int p,int ql,int qr) {
    if(l>=ql&&r<=qr)return t[p].c[0][2];
    if(flag[p])pushdown(p);
    unsigned long long res=0;
    if(mid>=ql)res+=query(ls,ql,qr);
    if(mid<qr)res+=query(rs,ql,qr);
    return res;
}
void build(int l,int r,int p) {
    tag[p]=E,t[p].c[0][0]=r-l+1;
    if(l==r)return;
    build(ls),build(rs);
}
void init() {
    for(int i=0;i<3;i++)E.c[i][i]=1;
    build(1,n,1);
}
int main(){
    n=read(),m=read(),init();
    for(rg int i=1;i<=n;i++)a[i]=read();
    for(rg int i=1;i<=n;i++)if(a[i]!=a[i-1])lft.insert(mp(i,a[i]));
    lft.insert(mp(n+1,0));
    for(rg int o,l,r,w,cs=1;cs<=m;cs++) {
        o=read(),l=read(),r=read(),w=read();
        if(o==1) {
            auto L=lft.upper_bound(mp(l,inf));--L;
            auto R=lft.upper_bound(mp(r,inf));
            int tl=L->first,tr=(R->first)-1,wl=L->second,wr;
            --R,wr=R->second,++R;
            //printf("case%d: %d %d %d %d\n",cs,tl,tr,wl,wr);
            for(auto i=L;i!=R;) {
                auto j=i;
                ++i,b[j->second]+=query(1,n,1,j->first,(i->first)-1);
                lft.erase(j);
            }b[w]-=query(1,n,1,l,r),lft.insert(mp(l,w));
            if(l>tl)b[wl]-=query(1,n,1,tl,l-1),lft.insert(mp(tl,wl));
            if(r<tr)b[wr]-=query(1,n,1,r+1,tr),lft.insert(mp(r+1,wr));
            update(1,n,1,1,n,0);
        }
        else {
            update(1,n,1,l,r,w);
            if(l>1)update(1,n,1,1,l-1,0);
            if(r<n)update(1,n,1,r+1,n,0);
        }
    }
    for(auto i=lft.begin();i!=lft.end();) {
        auto j=i;
        ++i;
        b[j->second]+=query(1,n,1,j->first,(i->first)-1);
    }
    for(rg int i=1;i<=n;i++)printf("%llu ",b[i]);
    return 0;
}

Details

answer.code:1:2: error: invalid preprocessing directive #define_FORTIFY_SOURCE0
    1 | #define_FORTIFY_SOURCE0
      |  ^~~~~~~~~~~~~~~~~~~~~~
answer.code:2:2: error: invalid preprocessing directive #pragmaGCCoptimize
    2 | #pragmaGCCoptimize(”Ofast,no−stack−protector”)
      |  ^~~~~~~~~~~~~~~~~
answer.code:2:20: error: extended character ” is not valid in an identifier
    2 | #pragmaGCCoptimize(”Ofast,no−stack−protector”)
      |                    ^
answer.code:2:27: error: extended character − is not valid in an identifier
    2 | #pragmaGCCoptimize(”Ofast,no−stack−protector”)
      |                           ^
answer.code:2:27: error: extended character − is not valid in an identifier
answer.code:2:27: error: extended character ” is not valid in an identifier
answer.code:3:2: error: invalid preprocessing directive #pragmaGCCtarget
    3 | #pragmaGCCtarget(”sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native”)
      |  ^~~~~~~~~~~~~~~
answer.code:3:18: error: extended character ” is not valid in an identifier
    3 | #pragmaGCCtarget(”sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native”)
      |                  ^
answer.code:3:68: error: extended character ” is not valid in an identifier
    3 | #pragmaGCCtarget(”sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native”)
      |                                                                    ^