CSP 2026游记
updated:去除同学名字,同学让去掉的,管理员求过,之前上过全站推荐
终于可以上谷了
CSP -INF day
同学说要AK%%%
初赛s快结束的时候检查改错了好几题,挺遗憾的
CSP -1 day
上完一天课直接去酒店,品尝麦麦。晚上认真复习了模板,做了一些dp题
CSP 1 day
hmmm
6:00起床看了看模板
7:30打车去考场(GDFZ)
8:30到但没赶上合照
9:30
T1:
5min切了
赛后总结:要看清题目,这里是ABCDF,不看清题很容易想成ABCDE
T2:
hmmm题读完大概会了,但是双指针没调出来,只得写了暴力
赛后总结:
不会就打暴力的思路还是不错的
调题能力有待提升,代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10;
ll a[N];
char c[N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;cin>>n;
for(int i=1;i<=n;++i)cin>>a[i]>>c[i];
int l=1,r=n;
ll tl=a[1],tr=a[n],res=0;
while(l<r){
ll t=min(tl,tr);
if(c[l]!=c[r])res+=t;
tl-=t;tr-=t;
if(tl==0){l++;tl=a[l];}
if(tr==0){r--;tr=a[r];}
}
cout<<res<<endl;
return 0;
}
T3:
看完题后不大会,骗了分
洛谷上测出45,同学说可以骗70多
赛后总结:
这题是贪心,进制,和位运算,要是考试时注意力集中写出来就好了
代码
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int n,k,a[N];
bool st[N];
int main(){
cin>>n>>k;k=n-k;
int res=0;
for(int i=1;i<=n;i++){
cin>>a[i];
res|=a[i];
}
int ans=0;
for(int p=31;p>=0;p--){
if(!(res>>p&1))continue;
int t=0;
for(int i=1;i<=n;i++){
if(st[i])continue;
if(!(a[i]>>p&1))t++;
}
if(t>k)continue;
for(int i=1;i<=n;i++){
if(!(a[i]>>p&1))st[i]=true;
}
k-=t;
ans|=1<<p;
}
cout<<ans;
return 0;
}
T4:
我去不就是模拟吗
~看到数据范围后:我靠模拟个滚木啊~
只得骗分48pts,一开始写了个O(N^3),后来加上记忆化优化成O(N^2)
赛后总结:
同学说校内模拟赛原题(其实也没有那么原)
我靠西西弗托梦给zhq叔叔了吗
翻了翻OJ比赛列表,我靠刚好这题我没补
代码:
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 5e5 + 5, M = 3e5 + 5;
int n, m, a[N], fa[N], sz[N], pos[M], lst[M];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; i++) cin >> a[i];
for(int i = n; i >= 1; i--) {
if(pos[a[i]])fa[i] = pos[a[i]];
else {
fa[i] = i + 1;
lst[a[i]] = i;
}
pos[a[i]] = i;
}
for(int i = 1; i <= n + 1; i++) sz[i] = 1;
for(int i = 1; i <= n; i++) sz[fa[i]] += sz[i];
for(int i = 1; i <= m; i++) cout << sz[lst[i]] << (i == m ? '\n' : ' ');
return 0;
}
出考场:(哭哭哭)这次考砸了不会要AFO吧,面基了kaiddsa
又拍了合照
周围都是dsa。。。
如果同学想要去掉名字私信
PS: 据说s时候shenlinhao和LiangNingyu(学姐)坐在一起被磕了