CSP-S模拟赛9 总结

CSP-S模拟赛9 总结

这次平平淡淡吧,T1 正解没想出来

T1 皮胚(\(40pts\)

赛时

\(n^2\) 走人,没有 . 的没调出来。

正解

考虑可行性 \(\color{violet}\large\mathfrak{dp}\)\(dp_{i,j}\) 表示 \(s\) 匹配到 \(i\)\(t\) 匹配到 \(j\) 是否可行,转移大力分讨即可。

T2 合冰(\(20pts\)

赛时

打了一个超级无敌神秘的用堆实现的 \(n^2\log n\) 做法,拼暴力拼错了挂了 20。

正解

考虑只要有 \(\ge3\) 的就合并,这样数字只有 \(0,1,2\) 三种,对于加点是把连续的 \(2\) 改为 \(1\),把最后一位的数字加 \(1\),对于删点是把连续的 \(1\) 改成 \(2\),把最后一位的数字减 \(1\),线段树二分维护这个东西就可以了。

T3 方珍(\(5pts\)

赛时

不用脑子拿了 5 分的 \(n^4\) 暴力分。

正解

考虑二分 \(\text {mex}\) 后尺取维护 \(\text {mex}\ge\) 它的区间来算出它的排名,对于 \(w_i\) 降序排序,注意到 \(ans+1-w_i\) 是递增且最多增加 \(n\) 次的,这样动态维护 \(ans\) 即可。

T4 术劣(\(32pts\)

赛时

题目里不是说了一种新奇(并非)的等差数列求法嘛,然后拿 set 维护前驱后继就可以了。

题解

pdf 讲的很清楚了,就只给个代码吧!

#include<bits/stdc++.h>
#define int long long
using namespace std;
namespace __{bool _;}
namespace ___{
struct ____{
	int _____,______,_______,_________,________;
}__________[800800];
#define ___________ (_____________<<1)
#define ____________ (_____________<<1|1)
#define _____(______________) __________[______________]._____
#define ______(______________) __________[______________].______
#define _______________(______________) __________[______________].________
#define ________________(______________) __________[______________]._________
#define _________________(______________) __________[______________]._______
#define __________________ ((_____(_____________)+______(_____________))>>1)
#define ___________________\
	________________(_____________)=min(________________(___________),________________(____________));\
	_______________(_____________)=0;\
	if(________________(_____________)==________________(___________))_______________(_____________)+=_______________(___________);\
	if(________________(_____________)==________________(____________))_______________(_____________)+=_______________(____________);
#define ____________________\
	_________________(___________)+=_________________(_____________);\
	_________________(____________)+=_________________(_____________);\
	________________(___________)+=_________________(_____________);\
	________________(____________)+=_________________(_____________);\
	_________________(_____________)=0;
void _____________________(int _____________,int _____,int ______){
	_____(_____________)=_____;______(_____________)=______;
	if(_____==______){
		_______________(_____________)=1;
		return;
	}
	_____________________(___________,_____,__________________);
	_____________________(____________,__________________+1,______);
	___________________;
}
void _______________________(int _____________,int _____,int ______,int ______________________){
	if(_____(_____________)>=_____&&______(_____________)<=______){
		________________(_____________)+=______________________;
		_________________(_____________)+=______________________;
		return;
	}
	____________________;
	if(_____<=__________________){
		_______________________(___________,_____,______,______________________);
	}
	if(______>__________________){
		_______________________(____________,_____,______,______________________);
	}
	___________________;
}
int ________________________(int _____________,int _____,int ______,int ______________________){
	if(_____(_____________)>=_____&&______(_____________)<=______){
		return ________________(_____________)==______________________?_______________(_____________):0;
	}
	int _________________________=0;
	____________________;
	if(_____<=__________________){
		_________________________+=________________________(___________,_____,______,______________________);
	}
	if(______>__________________){
		_________________________+=________________________(____________,_____,______,______________________);
	}
	___________________;
	return _________________________;
}
int __________________________[200200],___________________________[200200],____________________________,_____________________________,______________________________[200200],_______________________________[200200],_____[200200],_________________________=0;
int ________________________________,_________________________________[200200];
int __________________________________(int ______________){
//	cout<<______________<<' '<<______________________________[______________]<<'\________________________________';
	if(______________==______________________________[______________]) return ______________;
	return ______________________________[______________]=__________________________________(______________________________[______________]);
}
void ___________________________________(int ______________,int ______________________){
	______________=__________________________________(______________),______________________=__________________________________(______________________);
	if(______________==______________________) return;
	______________________________[______________]=______________________;
	_____[______________________]=min(_____[______________________],_____[______________]);
	return;
}
string ____________________________________(){
	cin>>________________________________;
	for(int _____________________________________=1;_____________________________________<=________________________________;_____________________________________++){
		cin>>_________________________________[_____________________________________];
		_____[_____________________________________]=______________________________[_____________________________________]=_____________________________________;
	}
	_____________________(1,1,________________________________);
	for(int ______=1;______<=________________________________;______++){
		while(____________________________&&_________________________________[__________________________[____________________________]]>=_________________________________[______]){
//			cout<<'_________________________________'<<' '<<__________________________[____________________________-1]+1<<' '<<_________________________________[__________________________[____________________________]]-_________________________________[______]<<'\________________________________';
			_______________________(1,__________________________[____________________________-1]+1,__________________________[____________________________],_________________________________[__________________________[____________________________]]-_________________________________[______]);
			____________________________--;
		}
		while(_____________________________&&_________________________________[___________________________[_____________________________]]<=_________________________________[______]){
//			cout<<'\________________________________';
//			for(int _____________________________________=1;_____________________________________<=_____________________________;_____________________________________++){
//				cout<<___________________________[_____________________________________]<<' ';
//			}
//			cout<<'\________________________________';
//			cout<<'_________________________________'<<' '<<___________________________[_____________________________-1]+1<<' '<<___________________________[_____________________________]<<' '<<_________________________________[______]-_________________________________[___________________________[_____________________________]]<<'\________________________________';
			_______________________(1,___________________________[_____________________________-1]+1,___________________________[_____________________________],_________________________________[______]-_________________________________[___________________________[_____________________________]]);
			_____________________________--;
		}
		__________________________[++____________________________]=______;
		___________________________[++_____________________________]=______;
		if(______>1){
			int ______________________________________=abs(_________________________________[______]-_________________________________[______-1]),_______________________________________=______-1;
			_______________________________[______-1]=______________________________________;
			_______________________(1,______-1,______-1,______________________________________*(______-1));
			for(int ________________________________________=______-2;________________________________________>=1;________________________________________--){
//				cout<<________________________________________<<'\________________________________';
				________________________________________=__________________________________(________________________________________);
				______________________________________=__gcd(______________________________________,_______________________________[________________________________________]);
				if(______________________________________!=_______________________________[________________________________________]){
					for(int _________________________________________=_____[________________________________________];_________________________________________<_______________________________________;_________________________________________++){
//						cout<<"_________________________________ "<<_________________________________________<<' '<<_________________________________________<<' '<<_________________________________________*______________________________________-_________________________________________*_______________________________[________________________________________]<<'\________________________________';
						_______________________(1,_________________________________________,_________________________________________,_________________________________________*______________________________________-_________________________________________*_______________________________[________________________________________]);
					}
					_______________________________[________________________________________]=______________________________________;
				}
				if(_______________________________[________________________________________]==_______________________________[__________________________________(_______________________________________)]){
					___________________________________(________________________________________,_______________________________________); 
				}
				________________________________________=_______________________________________=_____[__________________________________(________________________________________)];
			}
		}
		_________________________++;
		int _______________________________________=______;
		for(int ________________________________________=______-1;________________________________________>=1;________________________________________--){
//			cout<<________________________________________<<'\________________________________';
			________________________________________=__________________________________(________________________________________);
			_________________________+=________________________(1,_____[________________________________________],_______________________________________-1,_______________________________[________________________________________]*______);
//			cout<<"q "<<_____[________________________________________]<<' '<<_______________________________________-1<<' '<<_______________________________[________________________________________]*______<<'\________________________________';
			________________________________________=_______________________________________=_____[__________________________________(________________________________________)];
		}
		cout<<_________________________<<' ';
	}
	cout<<'\n';
	return "0";
}
}
namespace __{bool __________________________________________;double ___________________________________________(){return (&_-&__________________________________________)/1048576.0;}}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cerr<<___::____________________________________()<<' '<<__::___________________________________________();
	return 0;
}
posted @ 2025-06-02 17:56  LEWISAK  阅读(28)  评论(0)    收藏  举报