跳到正文

个人记录

CSP2023 翻车记

霖ux约 12 分钟
原文
文章信息与版本

文章信息

发布
2023年10月17日
收录
2025年12月12日
更新
2026年10月23日
篇幅
约 12 分钟
获赞
1

版本

  1. v1当前

不一定能进NOIP,但还是先把坑开了。
最后一个赛季,重在参与。

CSP D-3

已退役选手时隔一年再次来到学校机房。
机房的学弟都高二了,然而根本不认识。

CSP D-2

花了大半个晚自习看完了罗勇军上册。
想起去年即将参加NOIP的自己在这书刚出的时候买回来花了一个晚自习看完在教练面前锐评其中看不中用,现在早已修为尽失的我再重新看一遍确是收获不少,渐渐找回了些感觉当时的感觉。
按我现在的速度来看,在CSP前看完下册是不现实了。
板子又是一个大问题,现在已经忘得差不多了,昨天晚上一个ST表就码了半个小时。
现在自然是没有以前那么充裕的时间来练了,这次CSP恐怕是凶多吉少。

CSP D-1

大半个晚自习看了一章半,实力是大不如从前了。
这次搞不好要抱零。
之前选了linux考场,为了能调试(打了两年OI,windos的调试多数时候都是不能正常工作的)和sublime的批量修改(这玩意在去年省选D2的时候救了我的命)
考场似乎就两同学用linux,考场老师今天还贴心地打电话来问配置。
晚上熬夜背FHQ-Treap

CSP D0

回到了翔宇楼机房,故地重游让人感慨。
这个挂牌为“绿色网吧”的地方曾经见证了“Green Empire”的兴起与覆灭。
明天就考试,然而就请了一下午假,几乎没有准备的时间。
把某位大佬出的黄题给学弟做,就结果而言,他们有着非常巨大的进步空间,祝他们有一个光明的未来。
晚上熬夜背dinic和EK

CSP D1&NOIP D-27

早上上了四节课,两节英语考试,语文化学不敢摸,总之就是没有时间复习了。
还是经典的自驾去考场,没有机试。
在车上押今年考字符串,背了下AC自动机,虽然确实是考了字符串,然而跟想象的不太一样。

全场只有两台linux,在考场最后面,一开始还被监考老师领到了windows的位置。
T1枚举第一个串的修改,复杂度O(81×5n)\mathcal O(81\times 5n),不知道出题人吃了什么东西数据出成这样,显然是给纯暴力量身定制,撑死橙题,但是退役许久又反复读错题意的本菜鸡写了1h。
T2卡了一下,一开始以为是个dp,手玩了一下发现可以用栈模拟,一次可以处理一个后缀,复杂度O(n2)\mathcal O(n^2),又发现把两个消完的串拼起来要求两个串完全相反,于是使用猫树分治加哈希可以做到O(nlog⁡2n)\mathcal O(n\log_2n)(CSPT2写出了紫题的感觉,不过貌似原题也是紫,数据还被加强了,不然我这复杂度似乎能过),但是本菜鸡忘了有什么质数,于是在里面写了个排序,最后写出来的是O(nlog⁡22n)\mathcal O(n \log_2^2n),大概也花了1h。
T3题面看了好久,确认完是个恶心的大模拟后开了T4,然后在过了20min后无奈回到T3。
还有一个半小时,我觉得有拿满的希望,然而让这个退役了一年的菜鸡写大模拟简直是要了它的命。
在还剩20min的时候还剩最后一个操作,无奈推倒写前面两个点,最后RE喜提0pts。 (没看到几个D的部分分,最后20min应该用来调前面代码的)

不出意外:100+85+0+0=185100+85+0+0=185,按今年T1的离谱程度省一无望。
NOIP rp++

Ending

不出意外还是出意外了
T1读成样例lock1.in,全无了
还是一如既往的难堪大用
小图灵0+85+0+0=850+85+0+0=85
FJ600+ 教练没名额 无缘NOIP
就这样笑话般地结束了罢

附代码
T1

C++
#include<cstdio>
#include<algorithm>
using namespace std;
//#define int long long 
inline int read(){
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9')f=(c!='-'),c=getchar();
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	if(f)return x;return -x;
}
int st[10][10],now[10],n,ans;
void print(){for(int i=1;i<=5;i++)printf("%d ",now[i]);putchar('\n');}
void dfs(int cur,int flag){
	if(cur==6){if(!flag)return;
		int ok=1;
		for(int i=2;i<=n;i++){
			int cnt=0,p=0;for(int j=1;j<=5;j++)if(st[i][j]!=now[j])cnt++,p=j;
			if(cnt!=1&&cnt!=2)ok=0;
			if(cnt==1)continue;
			if(cnt==2)if((st[i][p]-now[p]+10)%10!=(st[i][p-1]-now[p-1]+10)%10)ok=0;
		}
		if(ok)ans++;return;
	}
	now[cur]=st[1][cur];
	dfs(cur+1,flag);
	if(!flag){
		for(int i=1;i<=9;i++){now[cur]=(st[1][cur]+i)%10;dfs(cur+1,1);}
		if(cur!=1)for(int i=1;i<=9;i++){now[cur]=(st[1][cur]+i)%10,now[cur-1]=(st[1][cur-1]+i)%10;dfs(cur+1,1);}
	}

}
signed main(){
	freopen("lock1.in","r",stdin);
	freopen("lock1.out","w",stdout);
	n=read(),ans=0;
	for(int i=1;i<=n;i++)for(int j=1;j<=5;j++)st[i][j]=read();
	dfs(1,0);printf("%d",ans);return 0;
}

T2

C++
#include<cstdio>
#include<algorithm>
using namespace std;
#define int long long 
inline int read(){
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9')f=(c!='-'),c=getchar();
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	if(f)return x;return -x;
}
inline int get(){char c=getchar();while(c<'a'||c>'z')c=getchar();return c-'a'+1;}
const int maxn=3e6;
typedef unsigned long long ull; 
int a[maxn],st[maxn],top,cnt1[maxn],cnt2[maxn],n;
ull hash1[maxn],hash2[maxn],tmp[maxn],ans;
void solve(int l,int r){
	if(r<=l)return;
	int mid=(l+r)>>1;int top;
	top=0;for(int i=mid;i>=l;i--){
		if(top&&a[st[top]]==a[i])hash1[mid-i+1]=hash1[mid-st[top]],top--;
		else hash1[mid-i+1]=37ull*hash1[mid-i]+a[i],st[++top]=i;
	}
	top=0;for(int i=mid+1;i<=r;i++){
		if(top&&a[st[top]]==a[i])hash2[i-mid]=hash2[st[top]-mid-1],top--;
		else hash2[i-mid]=37ull*hash2[i-mid-1]+a[i],st[++top]=i;
	}
	int t1=mid-l+1,t2=r-mid,tot=0;
	for(int i=1;i<=t1;i++)tmp[++tot]=hash1[i];
	for(int i=1;i<=t2;i++)tmp[++tot]=hash2[i];
	sort(tmp+1,tmp+tot+1);tot=unique(tmp+1,tmp+1+tot)-tmp-1;
	for(int i=1;i<=tot;i++)cnt1[i]=cnt2[i]=0;
	for(int i=1;i<=t1;i++)cnt1[lower_bound(tmp+1,tmp+1+tot,hash1[i])-tmp]++;
	for(int i=1;i<=t2;i++)cnt2[lower_bound(tmp+1,tmp+1+tot,hash2[i])-tmp]++;
	for(int i=1;i<=tot;i++)ans+=cnt1[i]*cnt2[i];
	solve(l,mid);solve(mid+1,r);
}
signed main(){
	freopen("game.in","r",stdin);
	freopen("game.out","w",stdout);
	n=read(),ans=0;
	for(int i=1;i<=n;i++)a[i]=get();
	solve(1,n);printf("%lld",ans);
	return 0;
}

T3

C++
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<map>
#include<vector>
using namespace std;
#define int long long 
inline int read(){
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9')f=(c!='-'),c=getchar();
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	if(f)return x;return -x;
}
const int maxn=500;
/*
map<string,int> type,element,name;
vector<pair<int,int>> mem[maxn];
int siz[maxn],q[maxn],tp[maxn],st[maxn],lst[maxn],tot,mt,et;
void opt1(){string s;cin>>s;
	type[s]=++tot;
	int k=read();
	for(int i=1;i<=k;i++){
		string s1,s2;cin>>s1;cin>>s2;
		if(!name.count(s2))name[s2]=++mt;
		int ty=type[s1],na=name[s2];
		mem[tot].push_back({na,ty});
		q[tot]=max(q[tot],q[ty]);
		if(siz[tot]%q[ty]){
			siz[tot]+=siz[ty]+q[i]-siz[tot]%q[i];
		}else siz[tot]+=siz[ty];
	}
}
void opt2(){
	string t,s;cin>>t;cin>>s;
	int ty=type[s];
	element[s]=++et;
	tp[et]=ty;
	if(lst%q[ty])st[et]=lst+q[ty]-lst%q[ty];else st[et]=lst;
	lst+=st[et];
}
int p[maxn];char ss[maxn];
void opt3(){
	string s;cin>>s;int tmp=1;p[tmp]=0;
	for(int i=0;i<s.long();i++){ss[i]=s[i];if(s[i]=='.')s[i]=0,p[++tmp]=i+1;}
	int ans=st[];
	for(int i=0;i<=tmp;i++){
		string t=c+p[i];

	}

}*/
map<string,int> type,element;
string name[maxn]; 
int lst,siz[maxn],q[maxn];
int st[maxn],tot,tp[maxn];
int col[8*maxn];
void opt1(){/*I hate da moni*/return;}
void opt2(){
	string s;cin>>s;
	element[s]=++tot;
	name[tot]=s;
	string t;cin>>t;
	int ty=type[t];
	tp[tot]=ty;
	if(lst%q[ty])st[tot]=lst+q[ty]-siz[tot]%q[ty];
	else st[tot]=lst;
	lst+=siz[ty];
	for(int i=st[tot];i<lst;i++)col[i]=tot;
}
void opt3(){
	string s;cin>>s;
	printf("%lld\n",st[element[s]]);
}
void opt4(){cout<<name[col[read()]];};


signed main(){
	freopen("struct.in","r",stdin);
	freopen("struct.out","w",stdout);
	name[0]="ERR";
	type["byte"]=1;siz[1]=q[1]=1;
	type["short"]=2;siz[2]=q[2]=2;
	type["int"]=3;siz[3]=q[3]=4;
	type["long"]=4;siz[4]=q[4]=8;
	int n=read();
	for(int i=1;i<=n;i++){
		switch(read()){
			case 1:opt1();break;
			case 2:opt2();break;
			case 3:opt3();break;
			case 4:opt4();break;
		}
	}
}

T4
无

原文
存档评论1 条抓取于