跳到正文

shitingjia

798962

(///-//).

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

资料

编号
798962
抓取

奖项

2025 CSP-J
一等奖
2024 CSP-S
二等奖

版本

  1. v2当前
  2. v1

.

AtCoder Rating of @unYT

Codeforces Rating of @luoyangqi

https://www.bilibili.com/video/BV1hu4y1P79B/?spm_id_from=333.999.0.0

https://www.luogu.com.cn/discuss/892421?page=1

https://www.luogu.com/article/om893g6h

https://blog.csdn.net/qq_46048008/article/details/126937326 美化

https://i.cnblogs.com/settings

https://www.luogu.me/

https://zhuanlan.zhihu.com/p/765761988

vector<vector<int>>vis(n, vector<int>(n));

https://www.luogu.me/article/elcduz92

https://open.maic.chat/

学习任务:

P4169 [Violet] 天使玩偶/SJY摆棋子

P12685 [国家集训队] 排队 加强版

https://www.luogu.me/article/cqhi72t6#1—gcd-log

ydkxj

https://www.luogu.com.cn/discuss/1357380

https://www.bilibili.com/video/BV1gca662EBm/

C++
/*
多测不清空,OI见祖宗。
multitesting without clearing,oier meets the LCA.
十年OI一场空,不开LL见祖宗。
Ten years of OI just AFO,no #define int long long sees the LCA.
似是神犇成才处,实为蒟蒻黄泉路。
It is likely to be the Au medal for the big old,but in fact it is the Si medal for me.
黄题有恨无正解,码力不若小学生。
A yellow problem I can't AC,codeforces is not as NB as EUlar Shai.
今生无奈入OI,来世不做信竞人。
This life I am a Silly Being in oi,next life I won't f**k the sh*t of infomatics.
*/

https://www.luogu.com.cn/article/0bq6mgfx

https://www.luogu.me/article/i7hs6yi1

觉得自己是废物的看这个

C++
const int Size=1<<16;
inline int gc(){
	static char buf[Size],*p=buf,*q=buf;
	if(p==q){
		q=buf+fread(buf,1,Size,stdin);
		if(q==buf)	return EOF;
		p=buf;
    }
    return (unsigned char)*p++;
}
inline int read(){
	int x=0;
	char ch=gc();
	bool f=0;
	while('9'<ch||ch<'0')	f|= ch == '-',ch=gc();
	while('0'<=ch&&ch<='9')	x=(x<<3)+(x<<1)+ch-'0',ch=gc();
	return f?-x:x;
}

https://sakinorva.net/test/function_bunya?lang=zh-hans

如果一等了向 陌生人Chiesl 讨要关注

共 1 篇
  1. 个人记录

    书签

    该题通过分块处理优化了大规模数据下的操作效率,主要思路如下: 分块策略:将序列划分为大小约为√n的块,每个块维护: cv:块内统一赋值的标记(-1表示无赋值) tag:块内统一加法的标记 s:块内元素和 cnt:块内元素存在的位集(bitset) 操作处理: 操作1(区间赋值):若区间跨块,先下放标记后对块进行赋值,更新块的cv和tag,并重新计算块内元素和。 操作2(求mex并加到区间):通过合并跨块的元素到全局桶all中,暴力枚举mex。若mex为0(即存在0且未被加过),则直接跳过加法操作(因加0无影响)。否则,将mex加到所有元素,并更新块的tag和s。 操作3(区间和查询):直接利用块的sum快速计算,若跨块则遍历两边的块和中间块的和。 关键优化: 懒标记管理:确保块内数据在操作前是最新状态,避免重复计算。 bitset加速判断:通过位集快速判断某个数是否存在于当前块中。 特判mex=0:当mex为0时,直接跳过加法操作,减少不必要的计算。 复杂度分析:每个操作的时间复杂度为O(√n),通过分块和懒标记的结合,整体复杂度可接受。特判mex=0进一步优化了极端情况下的性能。