2025年8月6日模拟测总结
wwb17752802808 · · 个人记录
2025年8月6日模拟测总结
Situation
| 题目名称 | cbarn | bgm | superbull | buffet |
|---|---|---|---|---|
| 预计得分 | 100 | 100 | 0 | 0 |
| 实际得分 | 80 | 100 | 10 | 7 |
Total score:197 points Rank:10th
Method
A 圆形谷仓 cbarn
—— Why didn't it AC?
Idea
把环转成链,把每个位置的奶牛尽量的往后挪。
My approach
和正解差不多,但是没有把环转成链,主要是证明了一下。
下面的第一条是由完全平方公式的来的,通过举例说明可以得出第二条。
-
(a+b)^2>a^2+b^2 (a,b>0) -
a+b=c+d (a,b,c,d>0)$ 时,如果 $ |a-b|>|c-d| $ 就有 $ a^2+b^2>c^2+d^2
举个栗子:
Score
80 points
Cause of losing points
不知道啊
B 谜题答案为 7 的倍数 bgm
—— Miracles from brutality!
Idea
说句很直觉上的事情,如果原式其中有一个因式是
最容易想到的是暴力DFS每个变量的值再检查,由于每个变量的值太多,就不能无脑的暴力。要知道值可以分成
My approach
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long llong;
int n, toint[300], s[20][10], len[5], b[10], cnt[5];
pair<int, int> c[5][10];
llong ans = 0;
int mo7(int x) {
return (x % 7 + 7) % 7;
}
void dfs(int i, llong sum) {
if (i > 7) {
bool flag = false;
for (int j = 1; j <= 3; j++) {
cnt[j] = 0;
for (int k = 1; k <= len[j]; k++) {
cnt[j] += b[c[j][k].first] * c[j][k].second;
cnt[j] = mo7(cnt[j]);
}
if (cnt[j] == 0)
flag = true;
}
if (flag)
ans += sum;
return;
}
for (int j = 0; j < 7; j++) {
b[i] = j;
dfs(i + 1, sum * s[i][j]);
}
}
int main() {
freopen("bgm.in", "r", stdin);
freopen("bgm.out", "w", stdout);
ios::sync_with_stdio(false); cin.tie(nullptr);
// 打表出省一
toint['B'] = 1;
toint['E'] = 2;
toint['S'] = 3;
toint['I'] = 4;
toint['G'] = 5;
toint['O'] = 6;
toint['M'] = 7;
c[1][1] = {1, 1}; c[1][2] = {2, 2}; c[1][3] = {3, 2}; c[1][4] = {4, 1}; len[1] = 4;
c[2][1] = {5, 1}; c[2][2] = {6, 1}; c[2][3] = {2, 1}; c[2][4] = {3, 1}; len[2] = 4;
c[3][1] = {7, 1}; c[3][2] = {6, 2}; len[3] = 2;
cin >> n;
memset(s, 0, sizeof(s));
for (int i = 1; i <= n; i++) {
char ch;
int x;
cin >> ch >> x;
s[toint[ch]][mo7(x)]++;
}
// 暴力出奇迹
dfs(1, 1);
cout << ans << endl;
return 0;
}
Score
100 points
Cause of losing points
这栏要不空着?
C 超级公牛 superbull
—— MST
Idea
要注意到的是整个结构其实是个树,这就好办了,建一棵树,跑最大生成树就行了!
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long llong;
const int N = 2001;
struct Edge {
int u, v, w;
};
int n, a[N], fa[N];
Edge edges[4000000];
int gf(int x) {
if (fa[x] == x) return x;
return fa[x] = gf(fa[x]);
}
int main() {
freopen("superbull.in", "r", stdin);
freopen("superbull.out", "w", stdout);
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
int m = 0;
for (int i = 1; i <= n; i++)
for (int j = 1; j < i; j++)
edges[++m] = {i, j, a[i] ^ a[j]};
sort(edges + 1, edges + m + 1, [] (const Edge &x, const Edge &y) { return x.w > y.w; });
for (int i = 1; i <= n; i++) fa[i] = i;
llong ans = 0;
for (int i = 1; i <= m; i++) {
int u = edges[i].u, v = edges[i].v, w = edges[i].w;
int fu = gf(u), fv = gf(v);
if (fu != fv) {
fa[fu] = fv;
ans += w;
}
}
printf("%lld\n", ans);
return 0;
}
My approach
不会。。。
Score
10 points
Cause of losing points
没做过这种题。。。
D Bessie 过生日 buffet
—— What
Idea
定义
My approach
不会。。。
Score
7 points
Cause of losing points
赛时懵了
Summarize
考得最差的一次 TAT
我的发,竟然还有人 AK 了?!
Reflections
稻花香里说丰年,听取WA声一片!