当前位置:网站首页>Temporary cramming before DFS examination
Temporary cramming before DFS examination
2022-07-05 15:26:00 【Xuanhong Zhou】
subject
It is suggested to use for Cycle through , I don't want to write now
Code
/* Because you can think about two problems in the same subject at the same time , Suppose it's divided into left right Left and right brain So for n questions , Yes 2^n Maybe , Generally, you can run in one second 4 * 10 ^ 8 Time The maximum range of this question is 4* 2^20 =4*1048576 It can be searched directly Think of the search of this topic as the search of a binary tree The left subtree is the left brain , The right subtree is the right brain And then it's normal dfs dfs Medium x Is how many questions have been done ,y Is the total number of topics in the current subject , If x Than y big , That's a plan */
#include<iostream>
#include<algorithm>
using namespace std;
const int N=30;
int hh[N][5];
int s[5];
int ans=0;
int l=0,r=0;
int mini;
void dfs(int x,int y){
// Recursive export
//dfs Medium x Is how many questions have been done ,y Is the total number of topics in the current subject
// If x Than y big , That's a plan
// Now update the minimum , You should take the maximum time in your left and right brain , Then and current mini Take a small value
if(x>s[y]){
mini=min(max(l,r),mini);
return ;
}
l+=hh[x][y];
dfs(x+1,y);// These two lines will cause all to be placed on the left brain
l-=hh[x][y];// Then go back
r+=hh[x][y];// Put it on the right brain
dfs(x+1,y);
r-=hh[x][y];
}
int main(){
cin>>s[1]>>s[2]>>s[3]>>s[4];
for(int i=1;i<=4;i++){
mini=19260816;
l=r=0;
for(int j=1;j<=s[i];j++)
cin>>hh[j][i];
dfs(1,i);
ans+=mini;
}
cout<<ans;
return 0;
}
边栏推荐
- JMeter performance test: serveragent resource monitoring
- How can the boss choose programmers to help me with development?
- R 熵权法计算权重及综合得分
- Good article inventory
- Crud of MySQL
- JS bright blind your eyes date selector
- I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
- 复现Thinkphp 2.x 任意代码执行漏洞
- 把 ”中台“ 的思想迁移到代码中去
- Explanation report of the explosion
猜你喜欢
[JVM] operation instruction
Creation and optimization of MySQL index
Explanation report of the explosion
Misc Basic test method and knowledge points of CTF
Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)
把 ”中台“ 的思想迁移到代码中去
Aike AI frontier promotion (7.5)
MySQL之CRUD
Bugku's Ah Da
Detailed explanation of QT creator breakpoint debugger
随机推荐
Array sorting num ranking merge in ascending order
美团优选管理层变动:老将刘薇调岗,前阿里高管加盟
Reproduce ThinkPHP 2 X Arbitrary Code Execution Vulnerability
mapper. Comments in XML files
I collect multiple Oracle tables at the same time. After collecting for a while, I will report that Oracle's OGA memory is exceeded. Have you encountered it?
Anti shake and throttling
Nine hours, nine people, nine doors problem solving Report
Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
30岁汇源,要换新主人了
First PR notes
P6183 [USACO10MAR] The Rock Game S
PHP high concurrency and large traffic solution (PHP interview theory question)
ICML 2022 | 探索语言模型的最佳架构和训练方法
Reasons and solutions for redis cache penetration and cache avalanche
MySQL----函数
市值蒸发超百亿美元,“全球IoT云平台第一股”赴港求生
1330:【例8.3】最少步数
Ten billion massage machine blue ocean, difficult to be a giant
你童年的快乐,都是被它承包了
Number protection AXB function! (essence)