DeepSeek-V3 R1深度思考 不联网 VS CSP-J 2024
前言
省流:
如题,不联网原因都知道,以免 ctj。
后续会更 CSP-S/NOIP 2024 的。
相关链接:
捞关于 DeekSeek R1 编程能力的讨论
Deepseek R1 真的有 CF 2000 Rating 的实力吗
如果让 DeepSeek-R1 开联网去考CSP-S,能蓝勾吗?
提示词
假如你是一位信息学竞赛生,请根据你的能力判断,并写出以下四道题的代码,文件输入输出流均为标准输出流,语言为 C++14,评测环境为 noi-linux2.0,时间限制均为 1s,空间限制均为 512MB,对于每一道题,请尽可能得到最高的分(即如果不会 100 分做法可以用更劣的时空复杂度或不保证正确的算法解决部分分),对于每一档部分分或正解分,请经过多次思考与反复用样例,自造数据检验没有问题才发出来,如果调试时间已经过久,请停止这档部分分,并思考下一档部分分。在最后把每一道题的代码独立地放出来,在代码上面依次标号:T1,T2,T3,T4。
Prompt 比较丰富,为了防止出现 cz 说的还有不打部分分这种抽象情况。
包含题面的提示词。
原来有一个“思考时间不得超过 1 个小时”,但是加上之后它思考 444 秒就说时间不够了,T4 直接摆烂输出
用时:
543 s
思考过程:
太长,而且markdown炸了,所以甩云剪贴板了。
代码:
T1:
#include <iostream>
#include <unordered_set>
using namespace std;
int main() {
int n;
cin >> n;
unordered_set<string> cards;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
cards.insert(s);
}
cout << 52 - cards.size() << endl;
return 0;
}
T2:
#include <iostream>
#include <vector>
using namespace std;
int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int n, m, k;
cin >> n >> m >> k;
int x0, y0, d0;
cin >> x0 >> y0 >> d0;
x0--; y0--;
vector<string> g(n);
for (int i = 0; i < n; i++) {
cin >> g[i];
}
vector<vector<bool>> visited(n, vector<bool>(m, false));
int x = x0, y = y0, d = d0;
visited[x][y] = true;
int count = 1;
for (int step = 0; step < k; step++) {
int nx = x + dirs[d][0];
int ny = y + dirs[d][1];
if (nx >= 0 && nx < n && ny >= 0 && ny < m && g[nx][ny] == '.') {
x = nx;
y = ny;
if (!visited[x][y]) {
visited[x][y] = true;
count++;
}
} else {
d = (d + 1) % 4;
}
}
cout << count << '\n';
}
return 0;
}
T3:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
vector<int> cnt = {6,2,5,5,4,5,6,3,7,6};
string construct_rest(int t, int m) {
string res;
for (int i = 0; i < t; i++) {
for (int d : {0, 1, 7, 4, 2, 3, 5, 6, 8, 9}) {
int c = cnt[d];
if (c > m) continue;
int rem = m - c;
int rem_t = t - i - 1;
if (rem < 2 * rem_t || rem > 7 * rem_t) continue;
res.push_back('0' + d);
m = rem;
break;
}
if (res.size() != i + 1) return "";
}
return res;
}
string solve(int n) {
if (n < 2) return "-1";
for (int k = 1; k <= n; k++) {
for (int d : {1, 7, 4, 2, 3, 5, 6, 8, 9}) {
int c1 = cnt[d];
if (c1 > n) continue;
int m = n - c1;
int t = k - 1;
if (t == 0) {
if (m == 0) return string(1, '0' + d);
} else {
if (m < 2 * t || m > 7 * t) continue;
string rest = construct_rest(t, m);
if (!rest.empty()) return string(1, '0' + d) + rest;
}
}
}
return "-1";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
string res = solve(n);
cout << (res.empty() ? "-1" : res) << '\n';
}
return 0;
}
T4:
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int n, k, q;
cin >> n >> k >> q;
unordered_map<int, unordered_set<int>> trans;
for (int p = 0; p < n; ++p) {
int l;
cin >> l;
vector<int> s(l);
for (int i = 0; i < l; ++i) {
cin >> s[i];
}
for (int i = 0; i < l; ++i) {
for (int j = i + 1; j < l && j - i + 1 <= k; ++j) {
int x = s[i];
int y = s[j];
trans[x].insert(y);
}
}
}
while (q--) {
int r, c;
cin >> r >> c;
if (r != 1) {
cout << 0 << '\n';
continue;
}
if (trans.find(1) != trans.end() && trans[1].count(c)) {
cout << 1 << '\n';
} else {
cout << 0 << '\n';
}
}
}
return 0;
}
评测结果
T1 100pts
T2 100pts
T3 60pts
T4 5pts
获奖情况
恭喜 DeepSeek-V3 R1 在所有省区获得一等奖!
恭喜 DeepSeek-V3 R1 获得全国一等奖!
恭喜 DeepSeek-V3 R1 获得 5 级钩子!
事实上,DeepSeek-V3 R1 擦线 0 分过的 CQ/ZJ 一等线。
总结
DeepSeek 的 T1,T2 切得比较稳健,说明模拟功底还可以。
但在 T2 关于时间复杂度思考有些久。而且认为 1s 只能跑 1e7,还用 vector 一通优化(AI 通病)。
T3 对于 dp 还是不错的,就是卡在一个地方出不来了,可以看出,哪怕是 DeepSeek,也摆脱不了不会高级贪心策略的锅。而且它的 dp 居然没有 t 穿,拿了 60,这令人意想不到。
T4 DeepSeek 打了个 r=1 的 5 分骗分,可以看出DeepSeek 对于比较难又不算板的题是选择很小的部分分并放弃