一、比赛情况
总题量:13
赛时过题:ACGHLM
赛后补题:BEI
二、自我反思
由于赛时对B题的误判。导致交了很多发都WA了,进而影响了后续心态,导致一些本应该写出来的题目比如E、I这两道规律题没时间写,最后B题也WA了。还徒增了大量罚时,得不偿失。总而言之,还是自己能力不足,还是需要多加训练。
三、补题报告
B、代价转移
核心思路:将题中数值变换问题转化为图论中的最短路问题。利用BFS遍历所有数值状态,用dp一维数组存储最小值。由于所有值均为正值,所以仅需入队一次即可得到答案,故还需一个check数组优化入队操作,确保每个数入队一次。
AC代码:
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <deque>
#include <cmath>
#include <climits>
#include <cstdlib>
#define endl '\n'
#define ll long long int
#define ull unsigned long long int
using namespace std;
const int mod = 1e9;
const int N = 1e4;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
ll a, b, c1, c2, c3;
cin >> a >> b >> c1 >> c2 >> c3;
if (a == b)
{
cout << 0 << endl;
continue;
}
vector<ll> dp(N + 1, INT_MAX);
vector<bool> check(N + 1, false);
queue<int> q;
dp[a] = 0;
q.push(a);
check[a] = true;
while (!q.empty())
{
int u = q.front();
q.pop();
check[u] = false;
if (u + 1 <= N)
{
if (dp[u] + c1 < dp[u + 1])
{
dp[u + 1] = dp[u] + c1;
if (!check[u + 1])
{
q.push(u + 1);
check[u + 1] = true;
}
}
}
if (u - 1 >= 1)
{
if (dp[u] + c2 < dp[u - 1])
{
dp[u - 1] = dp[u] + c2;
if (!check[u - 1])
{
q.push(u - 1);
check[u - 1] = true;
}
}
}
if (u * 2 <= N)
{
if (dp[u] + c3 < dp[u * 2])
{
dp[u * 2] = dp[u] + c3;
if (!check[u * 2])
{
q.push(u * 2);
check[u * 2] = true;
}
}
}
}
cout << dp[b] << endl;
}
return 0;
}
E、美好的每一天~不连续存在
核心思路:这是一道规律题。通过n增加的计算过程不难发现:
只需注意防溢出即可顺利AC。
AC代码:
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <deque>
#include <cmath>
#include <climits>
#include <cstdlib>
#define endl '\n'
#define ll long long int
#define ull unsigned long long int
using namespace std;
const int mod = 1000000007;
const int N = 1e5 + 5;
ll pw(ll a, ll b)
{
ll res = 1;
while (b > 0)
{
if (b % 2)
{
res = res * a % mod;
}
a = a * a % mod;
b >>= 1;
}
return res;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
ll a;
cin >> a;
ll ans1 = 1;
ll ans2 = 0;
for (ll i = 1; i <= a; i++)
{
ll xx = ans1;
ll yy = ans2;
ans1 = xx * xx % mod + 2 * yy * xx % mod;
ans2 = xx * xx % mod + yy * yy % mod;
}
ans1 %= mod;
ans2 %= mod;
cout << ans1 << " " << ans2 << endl;
return 0;
}
I、二进制转化

核心思路:注意到“01”和“10”数量是否相同取决于字符串头和字符串末尾的两个字符是否相同,结合这一性质,很容易能写出AC代码。
AC代码:
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <deque>
#include <cmath>
#include <climits>
#include <cstdlib>
#define endl '\n'
#define ll long long int
#define ull unsigned long long int
using namespace std;
const int mod = 1e9;
const int N = 1e5 + 5;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
int a, l, r;
string s;
cin >> a >> s >> l >> r;
if (s[0] == s[s.size() - 1])
{
cout << "Yes" << endl;
}
else
{
if (l == 1 || r >= s.size())
{
cout << "Yes" << endl;
}
else
{
cout << "No" << endl;
}
}
}
return 0;
}
四、总结
自认为这次比赛题目较为简单,但是赛时过题还是较少,主要原因还是在于自我实力不足,所以还需要多加训练,兹求进步。
(注:以上题目来源牛客网:(1条未读私信) 河南萌新联赛2025第(一)场:河南工业大学_ACM/NOI/CSP/CCPC/ICPC算法编程高难度练习赛_牛客竞赛OJ)