CSP2024 游记

又是一年 CSP。。。

10 月 5 日,终于过 S 初赛了。。。

然后开始漫长的备战。。

在考试开始前 1 day,我还在兢兢业业地学习图论。然后发现没有考。。。

10 月 25 日下午 15:30,来到 CQBS 试机。我想,怎么测试性能呢?于是就打开了 florr 在 xxboyxx 的加持下,florr 连续合成四个红色的,后来他去上厕所,我继续合成,然后就再也没有合成成功了。。。

10 月 26 日上午

来到 CQBS,发现是 4 考场的第一个,当时所有人都到了,感觉自己有点尴尬。

CSP-J2024 开始前

使用 5 5 5 分钟敲完快读快写头文件等等。

CSP-J2024 开始了!

然后题目密码还是没发,结果是老师把解压包、题目的密码搞混了。。。神明失去了光。

T1

发现 T1 是最简单的,直接开一个 map,统计不同字符串出现次数,再用 52 52 52 减去他不就 A 了?

#include <bits/stdc++.h>
using namespace std;
map<string, bool> m;
signed main() {
    
    
	ios::sync_with_stdio(false);
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int t, ans = 0;
	cin >> t;
	while (t--) {
    
    
		string a;
		cin >> a;
		if (!m[a])
			ans++, m[a] = 1;
	}
	cout << 52 - ans;
	return 0;
}

T2

有种写 bfs 的冲动,但是还是忍住了,于是把 dfs 里面核心代码给拎出来,然后就 A 了。

#include <bits/stdc++.h>
using namespace std;
char a[1010][1010];
int dx[] = {
    
    0, 1, 0, -1};
int dy[] = {
    
    1, 0, -1, 0};
bool vis[1010][1010];
int main() {
    
    
	ios::sync_with_stdio(false);
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t--) {
    
    
		int n, m, k;
		cin >> n >> m >> k;
		int x0, y0, d;
		cin >> x0 >> y0 >> d;
		for (int i = 1; i <= n; i++) {
    
    
			for (int j = 1; j <= m; j++) {
    
    
				cin >> a[i][j], vis[i][j] = 0;
			}
		}
		vis[x0][y0] = 1;
		int ans = 1;
		while (k--) {
    
    
			int xx = x0 + dx[d];
			int yy = y0 + dy[d];
			if (xx >= 1 && xx <= n && yy >= 1 && yy <= m && a[xx][yy] == '.') {
    
    
				x0 = xx, y0 = yy;
				if (!vis[xx][yy]) {
    
    
					ans++;
				}
				vis[xx][yy] = 1;
			} else {
    
    
				d = (d + 1) % 4;
			}
		}
		cout << ans << "\n";
	}
	return 0;
}

T3

哈哈哈哈,调了我三个小时,哈哈哈哈哈。

首先打了一个假算,然后发现输入 17 17 17 输出 228 228 228,输入 29 29 29 输出 2 ∗ ∗ ∗ ∗ 2**** 2,已经忘了。

首先

while (n - 7 > 28) {
    
    
	b[++id2] = 8;  //输出序列
	n -= 7;
}

然后 5 5 5 个 for。。。暴力枚举前 5 5 5 个数字的组合。

#include <bits/stdc++.h>
using namespace std;
int k[100], b[100010];
int main() {
    
    
	ios::sync_with_stdio(false);
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	k[0] = k[6] = k[9] = 6, k[1] = 2, k[2] = k[3] = k[5] = 5, k[4] = 4, k[8] = 7;
	while (t--) {
    
    
		int id2 = 0;
		int n;
		cin >> n;
		if (n == 1) {
    
    
			cout << "-1" << endl;
		} else if (n == 2) {
    
    
			cout << "1" << endl;
		} else if (n == 3) {
    
    
			cout << "7" << endl;
		} else if (n == 4) {
    
    
			cout << "4" << endl;
		} else if (n == 5) {
    
    
			cout << "2" << endl;
		} else if (n == 6) {
    
    
			cout << "6" << endl;
		} else if (n == 7) {
    
    
			cout << "8" << endl;
		} else if (n % 7 == 0) {
    
    
			for (int i = 1; i <= n / 7; i++) {
    
    
				cout << 8;
			}
			cout << endl;
		} else {
    
    
			while (n - 7 > 28) {
    
    
				b[++id2] = 8;
				n -= 7;
			}
			string a = "9999999999999999999";
			for (int i = -1; i <= 9; i++) {
    
    
				for (int j = -1; j <= 9; j++) {
    
    
					for (int o = -1; o <= 9; o++) {
    
    
						for (int l = -1; l <= 9; l++) {
    
    
							for (int m = -1; m <= 9; m++) {
    
    
								string b = "";
								int sum = 0;
								if (i != -1) {
    
    
									b += i + '0';
									sum += k[i];
								}
								if (j != -1) {
    
    
									b += j + '0';
									sum += k[j];
								}
								if (o != -1) {
    
    
									b += o + '0';
									sum += k[o];
								}
								if (l != -1) {
    
    
									b += l + '0';
									sum += k[l];
								}
								if (m != -1) {
    
    
									b += m + '0';
									sum += k[m];
								}
								if (sum == n && b.size() > 0 && b[0] != '0') {
    
    
									if (a.size() > b.size())
										a = b;
									else if (a.size() == b.size()) {
    
    
										a = min(a, b);
									}
								}
							}
						}
					}
				}
			}
			for (int i = 0; i < a.size(); i++) {
    
    
				b[++id2] = a[i] - '0';
			}
			sort(b + 1, b + 1 + id2);
			int kk = 0;
			for (int i = 1; i <= id2; i++) {
    
    
				if (b[i] != 0) {
    
    
					kk = i;
					cout << b[i];
					break;
				}
			}
			for (int i = 1; i <= id2; i++) {
    
    
				if (i != kk) {
    
    
					cout << b[i];
				}
			}
			cout << endl;
		}
	}
	return 0;
}

是不是很暴力?

关于坐我旁边的人

这个人好像很大佬的样子,在我切完 T3 的时候就已经做完 T4 了。(他说就是图论)然后就在旁边玩,不像我,T4 题目都还没读懂。因此他影响了我的心态(他 AK 后就做了某个经典舞蹈中的一个著名动作,所以我就知道他是大佬)。

T4

哈哈哈哈,只有 30min 偷窥 T4 神秘的面纱啦!

赶紧花 5min 写了一个 dfs 暴力,最后调了 20min。。。。

考试结束,请考生立即停笔

笑死,老师让我们乖乖地坐在位置上,哎,还要签字。

没错,这是今年才多出来的流程,在老师征集文件后会将每个代码大小、提交时间等等打印下来,需要你比对是否一致,最后签字,才能离场。

然后也是非常麻烦,硬控我 20min,差点老师就漏掉了我,哼!

10 月 26 日中午

去吃了一个乡村基,但是我想吃的没有了。。呜呜呜。

吃完后去看了看重庆市人民大礼堂。从外面看非常壮观。


此图片来自百度。

进去之后,发现里面全是座位,虽然有 5 ∼ 6 5\sim 6 56 层,但是还是太高了点。。。往上看是张这样:


此图片来自百度。

一直盯着上面,有一种眩晕的感觉。然后就在座位上坐了下来,本来打算睡觉,结果一直在想 CSP-J2024 预估分数。现在看来应该睡一会儿的。。。但当时的想法是如果我睡了,下午就会想睡觉(毕竟我每次中午午休后,下午考试就一直待机)。

14:03,离开大礼堂,开始返回考点。

14:24,到达机房,赶紧敲头文件等等。

14:30,题目密码准时发下来,比上午好多了。

CSP-S2024 开始,第一次进入 S 的我十分忐忑。

T1

签。为什么别人都用 sort,就我一个人用计数排序?!

T2

脑子抽了,把 O ( T ( n + m ) ) \mathcal{O}(T(n + m)) O(T(n+m)) 的正解想成 O ( T n m ) O(Tnm) O(Tnm) 的暴力。然后没打,就一直在调 O ( T n ) \mathcal{O}(Tn) O(Tn) 的算法。最后用了 3h,遗憾离场,最后只得了 40 p t s 40pts 40pts

T3

dfs,没什么好说的,只有 20 p t s 20pts 20pts

关于坐我旁边的人

一个 BS 的,首先他考试的时候敲键盘敲得很大声(据说是一种战术?)严重影响我的思考,并且他把小零食放在桌子下面,每过 15 15 15 分钟,弯下腰去食小零食,并且每次都会下座位,然后我又被影响了。

CSP2024 结束了

感觉自己好弱智啊,T2 连 dfs 都没写,关键是 O ( n m ) \mathcal{O}(nm) O(nm) 的 check 都没想到。

但愿能够拿下勾 6。

快祝我蓝勾!

猜你喜欢

转载自blog.csdn.net/2301_76224755/article/details/143434049