### Statement

Peel was a famous pirate painter. After months of careful preparation, he planned to steal art at the museum. In the structure of the museum, each hallway is either bifurcated into two corridors or leads to an exhibition room. Peel knew the number of paintings in each exhibition room, and he accurately measured the time of passing through each hallway. Due to his experience, he took the next painting for 5 seconds. Your task is to design a program that calculates how many paintings he can steal before the police arrive.

### Code

#include
using namespace std;
int f[207][607],Tlim,id;
void dfs(int u){
int len,x;cin>>len>>x;
len*=2;if (x){
for (int i=len;i<=Tlim;i++)
f[u][i]=min(x,(i-len)/5);
return;
}
int l=++id,r=++id,dfs(l),dfs(r);
for (int i=len;i<=Tlim;i++)
for (int j=0;j<=i-len;j++)
f[u][i]=max(f[u][i],f[l][j]+f[r][i-len-j]);
}
int main(){
ios::sync_with_stdio(false);
cin>>Tlim;
dfs(0);
cout<
 
 Share 【CodeVS 2845】排序的代价（sort）/ 题解 Origin [http://codevs.cn/problem/2845/] Statement There is a list of… 09 Jul 2018 【SoundHound Inc. Programming Contest 2018】 解题报告 比赛地址 [https://beta.atcoder.jp/contests/soundhound2018-summer-qual] Tasks – F – Acrostic – Ordinary Beauty… 08 Jul 2018 
 
 
 Zepto's © 2024 Data & privacy Contact → Published with Ghost • Theme Attila • System theme 
 $(document).ready(function () { var viewport =$(window); var post = $('.post-content'); // Responsive videos with fitVids post.fitVids(); // Format code blocks and add line numbers function codestyling() {$('pre code').each(function(i, e) { // Code highlight hljs.highlightElement(e); // No lines for plain text blocks if (!$(this).hasClass('language-text')) { var code =$(this); // Calculate amount of lines var lines = code.html().split(/\n(?!$)/g).length; var numbers = []; if (lines > 1) { lines++; } for (i = 1; i < lines; i++) { numbers += '<span class="line" aria-hidden="true">' + i + '</span>'; } code.parent().append('<div class="lines">' + numbers + '</div>'); } }); } codestyling(); // Reading progress bar on window top function readingProgress() { var postBottom = post.offset().top + post.height(); var viewportHeight = viewport.height(); var progress = 100 - (((postBottom - (viewport.scrollTop() + viewportHeight) + viewportHeight / 3) / (postBottom - viewportHeight + viewportHeight / 3)) * 100);$('.progress-bar').css('width', progress + '%'); (progress > 100) ? $('.progress-container').addClass('complete'):$('.progress-container').removeClass('complete'); } readingProgress(); // Trigger reading progress viewport.on({ 'scroll': function() { readingProgress(); }, 'resize': function() { readingProgress(); }, 'orientationchange': function() { readingProgress(); } }); });