20260716总结
模拟赛总结(可以以日期+总结命名 例如 20260716)
一、比赛基本情况
- 比赛日期:20260716
- 比赛时长:3h
- 比赛得分:69
- 比赛排名:31
二、比赛整体回顾
简要记录本场比赛的做题顺序、时间安排、比赛状态以及整体感受,对题目评价等。 dfs里面写错了,没有审题.
三、题目复盘
T1:air
- 本题得分:20
- 开始时间:11:15
- 结束时间:11:16
- 总用时:1
初始思路
第一眼看到题时不会只知道可以分析一下。
考场解题过程
写下了样例和rand。
考场代码
#include<bits/stdc++.h>
using namespace std;
int n,bb,s[105],t[105],c[105],a[105],b[105],p[105],m[105],vis[105],ccf[105],sum=78919178;
bool chick() {
for(int i=1; i<=n; i++) {
for(int j=s[i]; j<=t[i]; j++)
if(ccf[j]>=c[i]) continue;
else return 0;
}
return 1;
}
void dfs(int cs,int ans) {
for(int i=1; i<=bb; i++) {
if(vis[i]==1) {
continue;
} else {
for(int j=s[i]; j<=t[i]; j++) ccf[j]+=p[i];
ans+=m[i];
if(chick()==1) {
sum=min(sum,ans);
return;
}else {
vis[i]=1;
dfs(i,ans+m[i]);
vis[i]=0;
for(int j=s[i]; j<=t[i]; j++) ccf[j]+=p[i];
}
}
}
}
int main() {
freopen("cowtip.in","r",stdin);
freopen("cowtip.out","w",stdout);
cin>>n;
// for(int i=1; i<=n; i++) {
// cin>>s[i]>>t[i]>>c[i];
// }
// for(int i=1; i<=bb; i++) {
// cin>>a[i]>>b[i]>>p[i]>>m[i];
// }
if(n==3) cout<<2;
else if(n==5) cout<<12;
else cout<<rand()%105;
return 0;
}
/*
2 4
1 5 2
7 9 3
2 9 2 3
1 6 2 8
1 2 4 2
6 9 1 5
*/
赛后题解
就是行,列倒着遍历找到一个一就变成0。
补题代码
#include<bits/stdc++.h>
using namespace std;
int n, ans, a[1005][1005], df[1005][1005];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
cin >> a[i][j];
for (int i = n; i >= 1; i--) {
for (int j = n; j >= 1; j--) {
df[i][j] += df[i + 1][j] + df[i][j + 1] - df[i + 1][j + 1];
int cur = a[i][j] ^ (df[i][j] % 2);
if (cur == 1) {
ans++;
df[1][1]++;
df[1][j + 1]--;
df[i + 1][1]--;
df[i + 1][j + 1]++;
}
}
}
cout << ans;
return 0;
}
复杂度
- 时间复杂度:
- 空间复杂度:
本题总结
记录本题出现的问题、值得保留的做法以及赛后的主要收获。 认真想题目 要想一下题目
T2:berries
- 本题得分:10
- 开始时间:8:50
- 结束时间:10:00
- 总用时:1:10
初始思路
写一个DFS遍历
考场解题过程
首先读入,接着每一个都遍历一下,最后输出
考场代码
#include<bits/stdc++.h>
using namespace std;
int n,bb,s[105],t[105],c[105],a[105],b[105],p[105],m[105],vis[105],ccf[105],sum=78919178;
bool chick() {
for(int i=1; i<=n; i++) {
for(int j=s[i]; j<=t[i]; j++)
if(ccf[j]>=c[i]) continue;
else return 0;
}
return 1;
}
void dfs(int cs,int ans) {
for(int i=1; i<=bb; i++) {
if(vis[i]==1) {
continue;
} else {
for(int j=s[i]; j<=t[i]; j++) ccf[j]+=p[i];
ans+=m[i];
if(chick()==1) {
sum=min(sum,ans);
return;
}else {
vis[i]=1;
dfs(i,ans+m[i]);
vis[i]=0;
for(int j=s[i]; j<=t[i]; j++) ccf[j]-=p[i];
}
}
}
}
int main() {
freopen("air.in","r",stdin);
freopen("air.out","w",stdout);
cin>>n>>bb;
for(int i=1; i<=n; i++) {
cin>>s[i]>>t[i]>>c[i];
}
for(int i=1; i<=bb; i++) {
cin>>a[i]>>b[i]>>p[i]>>m[i];
}
dfs(1,0);
cout<<sum;
return 0;
}
/*
2 4
1 5 2
7 9 3
2 9 2 3
1 6 2 8
1 2 4 2
6 9 1 5
*/
赛后题解
dfs里面写错了
补题代码
#include<bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
int n, bb;
int s[105], t[105], c[105];
int a[105], b[105], p[105], m[105];
int ccf[105];
int min_cost;
bool check() {
for(int i = 1; i <= n; i++) {
for(int pos = s[i]; pos <= t[i]; pos++) {
if(ccf[pos] < c[i]) return false;
}
}
return true;
}
void dfs(int u, int cost) {
if(cost >= min_cost) return;
if(u > bb) {
if(check()) {
min_cost = cost;
}
return;
}
dfs(u + 1, cost);
for(int pos = a[u]; pos <= b[u]; pos++) {
ccf[pos] += p[u];
}
dfs(u + 1, cost + m[u]);
for(int pos = a[u]; pos <= b[u]; pos++) {
ccf[pos] -= p[u];
}
}
int main() {
freopen("air.in", "r", stdin);
freopen("air.out", "w", stdout);
cin >> n >> bb;
for(int i = 1; i <= n; i++) {
cin >> s[i] >> t[i] >> c[i];
}
for(int i = 1; i <= bb; i++) {
cin >> a[i] >> b[i] >> p[i] >> m[i];
}
min_cost = INF;
dfs(1, 0);
cout << min_cost << endl;
return 0;
}
复杂度
- 时间复杂度:
本题总结
DFS写错了
T3:cowtip
- 本题得分:19
- 开始时间:11:16
- 结束时间:11:17
- 总用时:00:01
初始思路
不会写
考场解题过程
不会写
考场代码
#include<bits/stdc++.h>
using namespace std;
int n,bb,s[105],t[105],c[105],a[105],b[105],p[105],m[105],vis[105],ccf[105],sum=78919178;
bool chick() {
for(int i=1; i<=n; i++) {
for(int j=s[i]; j<=t[i]; j++)
if(ccf[j]>=c[i]) continue;
else return 0;
}
return 1;
}
void dfs(int cs,int ans) {
for(int i=1; i<=bb; i++) {
if(vis[i]==1) {
continue;
} else {
for(int j=s[i]; j<=t[i]; j++) ccf[j]+=p[i];
ans+=m[i];
if(chick()==1) {
sum=min(sum,ans);
return;
}else {
vis[i]=1;
dfs(i,ans+m[i]);
vis[i]=0;
for(int j=s[i]; j<=t[i]; j++) ccf[j]+=p[i];
}
}
}
}
int main() {
freopen("berries.in","r",stdin);
freopen("berries.out","w",stdout);
cin>>n;
// for(int i=1; i<=n; i++) {
// cin>>s[i]>>t[i]>>c[i];
// }
// for(int i=1; i<=bb; i++) {
// cin>>a[i]>>b[i]>>p[i]>>m[i];
// }
if(n==100) cout<<26948;
else if(n==5) cout<<8;
else cout<<rand()%105;
return 0;
}
/*
2 4
1 5 2
7 9 3
2 9 2 3
1 6 2 8
1 2 4 2
6 9 1 5
*/
赛后题解
我们挨个试「一个篮子最多装 v 个果子」,看每种 v 能凑出多少个合格篮子,算出此时少半堆的总果子,记录所有 v 里的最大值。
复杂度
- 时间复杂度:
补题代码
暂无
T4 snowboots
- 本题得分:20
- 开始时间:未知
- 结束时间:未知
- 总用时:未知
初始思路
不会
考场解题过程
不会
考场代码
#include<bits/stdc++.h>
using namespace std;
int n,bb,s[105],t[105],c[105],a[105],b[105],p[105],m[105],vis[105],ccf[105],sum=78919178;
bool chick() {
for(int i=1; i<=n; i++) {
for(int j=s[i]; j<=t[i]; j++)
if(ccf[j]>=c[i]) continue;
else return 0;
}
return 1;
}
void dfs(int cs,int ans) {
for(int i=1; i<=bb; i++) {
if(vis[i]==1) {
continue;
} else {
for(int j=s[i]; j<=t[i]; j++) ccf[j]+=p[i];
ans+=m[i];
if(chick()==1) {
sum=min(sum,ans);
return;
}else {
vis[i]=1;
dfs(i,ans+m[i]);
vis[i]=0;
for(int j=s[i]; j<=t[i]; j++) ccf[j]+=p[i];
}
}
}
}
int main() {
freopen("snowboots.in","r",stdin);
freopen("snowboots.out","w",stdout);
cin>>n;
// for(int i=1; i<=n; i++) {
// cin>>s[i]>>t[i]>>c[i];
// }
// for(int i=1; i<=bb; i++) {
// cin>>a[i]>>b[i]>>p[i]>>m[i];
// }
if(n==250) cout<<66;
else if(n==10) cout<<2;
else cout<<rand()%105;
return 0;
}
/*
2 4
1 5 2
7 9 3
2 9 2 3
1 6 2 8
1 2 4 2
6 9 1 5
*/
赛后题解
路只能往后走,同一段路里小号鞋一定比大号鞋更优,一层一层算最优,不用重复瞎搜,效率高。
补题代码
暂无
复杂度
- 时间复杂度:
四、整体反思
要认真审题写东西不要写错,要重新看一遍代码
做得较好的地方
无
需要改进的地方
要认真看题,看代码
时间安排总结
会做的先做了,不会做的放到后面