跳到正文

Kobe_Bryant___

1430924

本人玩暗区突围《挺强》,可扶贫,叫(爹儿)是端游不是手游

在洛谷打开
资料、奖项与版本

资料

编号
1430924
抓取

#pragma GCC optimize(“Ofast,no-stack-protector,unroll-loops”) 快速模乘

using u32=unsigned; using u64=unsigned long long; using u128=unsigned __int128; const u32 P=998244353; inline u64 trans(u64 x) { constexpr u64 A=-(u64)P/P+1; constexpr u64 q=((u128(-(u64)P%P)<<64)+P-1)/P; return xA+u64((u128)xq>>64)+1; } inline void mul(u64& a,u64 z) { a=az(u128)P>>64; } inline u32 mul(u32 a,u64 z) { return atrans(z)(u128)P>>64; } gcd

#define ctz __builtin_ctz inline int gcd(int a,int b) { int az{ctz(a)},bz{ctz(b)},z{min(az,bz)},t;b>>=bz; while (a) a>>=az,t=a-b,az=ctz(t),b=min(a,b),a=abs(t); return b<<z; } 树状数组 1

struct FWT { int s1[N+5],s2[N+5],s3[N+5]; void init() { memset(s1,0,sizeof(s1)),memset(s2,0,sizeof(s2)),memset(s3,0,sizeof(s3)); } void add(int x,int y) { for(int i=((x>>6)<<6);i<=x;++i) s1[i]+=y; for(int i=((x>>12)<<6);i<(x>>6);++i) s2[i]+=y; for(int i=0;i<(x>>12);++i) s3[i]+=y; } int qry(const int &x) { return s1[x]+s2[x>>6]+s3[x>>12]; } } T; 树状数组 2

struct fwt { int t[N+5],n; unsigned long long b[N+5]; void clear() { n=::n; fill_n(t+1,n,0); fill_n(b,n+1,0); n=(n>>6)+1; } int px(int x) { int y{x&63},z{x>>6}; return __builtin_popcountll(b[z]&((y==63?0:1ull<<(y+1))-1)); } int qry(int l,int r) { —l; int ans{px(r)-px(l)}; l>>=6;r>>=6; while (r>l) ans+=t[r],r&=r-1; while (l>r) ans-=t[l],l&=l-1; return ans; } void add(int x) { b[x>>6]|=1uLL<<(x&63); x=(x>>6)+1; while (x<=n) { ++t[x]; x+=x&-x; } } int qry(int x) { int ans{px(x)}; x>>=6; while (x) { ans+=t[x]; x&=x-1; } return ans; } } t; 静态 TopTree

C
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
快速模乘

using u32=unsigned;
using u64=unsigned long long;
using u128=unsigned __int128;
const u32 P=998244353;
inline u64 trans(u64 x) {
	constexpr u64 A=-(u64)P/P+1;
	constexpr u64 q=((u128(-(u64)P%P)<<64)+P-1)/P;
	return x*A+u64((u128)x*q>>64)+1;
}
inline void mul(u64& a,u64 z) {
	a=a*z*(u128)P>>64;
}
inline u32 mul(u32 a,u64 z) {
	return a*trans(z)*(u128)P>>64;
}
gcd

#define ctz __builtin_ctz
inline int gcd(int a,int b) {
    int az{ctz(a)},bz{ctz(b)},z{min(az,bz)},t;b>>=bz;
    while (a) a>>=az,t=a-b,az=ctz(t),b=min(a,b),a=abs(t);
    return b<<z;
}
树状数组 1

struct FWT {
	int s1[N+5],s2[N+5],s3[N+5];
	void init() { memset(s1,0,sizeof(s1)),memset(s2,0,sizeof(s2)),memset(s3,0,sizeof(s3)); }
	void add(int x,int y) {
		for(int i=((x>>6)<<6);i<=x;++i) s1[i]+=y;
		for(int i=((x>>12)<<6);i<(x>>6);++i) s2[i]+=y;
		for(int i=0;i<(x>>12);++i) s3[i]+=y;
	}
	int qry(const int &x) { return s1[x]+s2[x>>6]+s3[x>>12]; }
} T;
树状数组 2

struct fwt {
    int t[N+5],n;
    unsigned long long b[N+5];
    void clear() {
        n=::n;
        fill_n(t+1,n,0);
        fill_n(b,n+1,0);
        n=(n>>6)+1;
    }
    int px(int x) {
        int y{x&63},z{x>>6};
        return __builtin_popcountll(b[z]&((y==63?0:1ull<<(y+1))-1));
    }
    int qry(int l,int r) {
        --l;
        int ans{px(r)-px(l)};
        l>>=6;r>>=6;
        while (r>l) ans+=t[r],r&=r-1;
        while (l>r) ans-=t[l],l&=l-1;
        return ans;
    }
    void add(int x) {
        b[x>>6]|=1uLL<<(x&63);
        x=(x>>6)+1;
        while (x<=n) {
            ++t[x];
            x+=x&-x;
        }
    }
    int qry(int x) {
        int ans{px(x)};
        x>>=6;
        while (x) {
            ans+=t[x];
            x&=x-1;
        }
        return ans;
    }
} t;
静态 TopTree

六国破灭非兵不利战不善弊在赂秦赂秦而力亏破灭之道也或曰六国互丧率赂秦耶曰不赂者以赂者丧盖失强援不能独完故曰弊在赂秦也秦以攻取之外小则获邑大则得城较秦之所得与战胜而得者其实百倍诸侯之所亡与战败而亡者其实亦百倍则秦之所大欲诸侯之所大患固不在战矣思厥先祖父暴霜露斩荆棘以有尺寸之地子孙视之不甚惜举以予人如弃草芥今日割五城明日割十城然后得一夕安寝起视四境而秦兵又至矣然则诸侯之地有限暴秦之欲无厌奉之弥繁侵之愈急故不战而强弱胜负已判矣至于颠覆理固宜然古人云以地事秦犹抱薪救火薪不尽火不灭此言得之齐人未尝赂秦终继五国迁灭何哉与嬴而不助五国也五国既丧齐亦不免矣燕赵之君始有远略能守其土义不赂秦是故燕虽小国而后亡斯用兵之效也至丹以荆卿为计始速祸焉赵尝五战于秦二败而三胜后秦击赵者再李牧连却之洎牧以谗诛邯郸为郡惜其用武而不终也且燕赵处秦革灭殆尽之际可谓智力孤危战败而亡诚不得已向使三国各爱其地齐人勿附于秦刺客不行良将犹在则胜负之数存亡之理当与秦相较或未易量呜呼以赂秦之地封天下之谋臣以事秦之心礼天下之奇才并力西向则吾恐秦人食之不得下咽也悲夫有如此之势而为秦人积威之所劫日削月割以趋于亡为国者无使为积威之所劫哉夫六国与秦皆诸侯其势弱于秦而犹有可以不赂而胜之之势苟以天下之大下而从六国破亡之故事是又在六国下矣

还没有收录这位用户的文章。