版本比较
来追梦搜索测试反思
正文
增加 30 行删除 30 行
12345623456789104 行未改动1516171819192021222323 行未改动474849505151525354555657575859606162626364656624 行未改动9192939495959697989910010110110210310410523 行未改动1291301311321331331341351351361371381391401411421431441451451461471481495 行未改动15515615715815916015916016116216216316416516616516616716816917017117217117217317417517624 行未改动20120220320420520520620720820916 行未改动22622722822923023123023123223323423423523623723823723823924024124241 行未改动28428528628728828828929029129129229329329429529629738 行未改动# 考试情况 [T1](https://www.luogu.com.cn/record/235094335) [T2](https://www.luogu.com.cn/record/235094354) [T3](https://www.luogu.com.cn/record/235094380) [T4]( ) [T5]( ) [T6]( ) [T1](https://www.luogu.com.cn/record/235094335) [T2](https://www.luogu.com.cn/record/235094354) [T3](https://www.luogu.com.cn/record/235094380)[T4]( ) [T5]( ) [T6]( )
# 题目总结## T1### 错误原因没考虑4 行未改动的情况```### 错误代码```cpp#include<bits/stdc++.h> #include<bits/stdc++.h>using namespace std;int n,m,maxx=-1;char ch[21][21];bool vis[21][21];23 行未改动 dfs(fi,se,1); cout<<maxx; return 0;}``` ```错误出在```cppvoid dfs(int a,int b,int ans)```的 `ans` 处。
### 正确思路走到一个格子就ans++;### 正确代码```cpp#include<bits/stdc++.h> #include<bits/stdc++.h>using namespace std;int n,m,maxx=0;char ch[21][21];bool vis[21][21];24 行未改动 cout<<maxx; return 0;}```
## T2### 错误原因用模拟水到50分### 错误代码```cpp#include<bits/stdc++.h> #include<bits/stdc++.h>using namespace std;int n,m,maxx=0;char ch[21][21];bool vis[21][21];23 行未改动 dfs(fi,se); cout<<maxx; return 0;}``` ```### 正确思路纯属0/1 dfs 纯属0/1 dfs### 正确代码```cpp#include <bits/stdc++.h>using namespace std;int n, s[10], b[10], minn = INT_MAX;void dfs( int i, int j, int g ) { if( i == n ) { if(g>0&&abs(j-g)<minn) minn=abs(j-g); return; } } dfs(i+1,j,g ); dfs(i+1,j*s[i],g+b[i] );}int main() {5 行未改动 cout<<minn; return 0;}``` ## T3
## T3### 错误原因骗分的,错误模拟(水零分)。 骗分的,错误模拟(水零分)。### 错误代码```cpp#include<bits/stdc++.h> using namespace std; #include<bits/stdc++.h>using namespace std;struct stu{ int a,b;}s[10];bool cmp(stu a,stu b){ return a.a+a.b<b.a+b.b; } return a.a+a.b<b.a+b.b;}int main(){ int n,m1=INT_MIN,m2=INT_MIN,ans=0; cin>>n; for(int i=1;i<=n;i++){24 行未改动 int sum=0; for(int i=1;i<n;i++){ sum+=max(a[bo[i]],b[bo[i+1]]); sum++; } } minn=min(minn,sum+1); return; } for(int i=1;i<=n;i++){16 行未改动 } dfs(1); cout<<minn; return 0;} ``` }```## T4### 错误原因未写 未写### 正确思路老师正解思路: 0000000 00000 0000000 000000000000 000000000*00——\000*0000*0*0——/00*0*0000*00 000*000 000000041 行未改动 cout<<s; return 0;}```
## T5### 错误原因未写 未写### 正确思路记忆化DFS 记忆化DFS```cppa==0 s[c]++;if(vis[a][b][c]){ continue;38 行未改动