暴力卡常求救
查看原帖
暴力卡常求救
743014
_H17_楼主2024/7/6 17:35
#include<bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
using namespace std;
unsigned n,tot,l,r,a[100001],x,y;
inline char gc(){
	static char buf[50000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,50000,stdin),p1==p2)?EOF:*p1++;
    //return getchar_unlocked();
    //return getchar();
}
inline void read(unsigned&x){
    unsigned c;
    x=0;
    while((c=gc())<48||57<c);
    while(48<=c&&c<=57)
        x=(x<<3)+(x<<1)+(c^48),c=gc();
    return;
}
int main(){
    register unsigned i;
    unsigned j;
    for(register unsigned c=gc();c^10u;c=gc())
        a[tot++]=c;
    for(read(n);n;--n){
        read(l),read(r),x=gc(),gc(),y=gc();
        i=l-1;
        if(r<8)
            goto g;
        j=r-9u;
        for(;i<j;i+=8u)
            a[i]=((a[i]^x)?a[i]:y),
            a[i+1]=((a[i+1]^x)?a[i+1]:y),
            a[i+2]=((a[i+2]^x)?a[i+2]:y),
            a[i+3]=((a[i+3]^x)?a[i+3]:y),
            a[i+4]=((a[i+4]^x)?a[i+4]:y),
            a[i+5]=((a[i+5]^x)?a[i+5]:y),
            a[i+6]=((a[i+6]^x)?a[i+6]:y),
            a[i+7]=((a[i+7]^x)?a[i+7]:y);
        g://i<r-9
        //j=r-2;
        for(;i<r;++i)
            a[i]=((a[i]^x)?a[i]:y);
    }
    //fwrite(a,sizeof(a),1,stdout);
    for(i=0;i+7<tot;i+=8u)
        putchar_unlocked(a[i]),putchar_unlocked(a[i+1]),putchar_unlocked(a[i+2]),putchar_unlocked(a[i+3]),
        putchar_unlocked(a[i+4]),putchar_unlocked(a[i+5]),putchar_unlocked(a[i+6]),putchar_unlocked(a[i+7]);
    for(;i<tot;++i)
        putchar_unlocked(a[i]);
    return 0;
}

最好的一次(评测机打波动,80pts->90pts,1020->984ms)

最后一个点1.2s卡不过去

注:有人暴力卡过这题了!

2024/7/6 17:35
加载中...