Array+DP leetcode-11.装更多的水】的更多相关文章

11. Container With Most Water 题面 Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which tog…
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a containe…
11. Container With Most Water Medium Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which…
题目 题目描述 JSZKC is the captain of the lala team. There are N girls in the lala team. And their height is [1,N] and distinct. So it means there are no two girls with a same height. JSZKC has to arrange them as an array from left to right and let h[i] be…
2021.11.30 eleveni的水省选题的记录 因为eleveni比较菜,eleveni决定先刷图论,再刷数据结构,同时每天都要刷dp.当然,对于擅长的图论,eleveni决定从蓝题开始刷.当然,eleveni的神秘好友崇青云会监督eleveni刷题. 图论: [P1772 ZJOI2006]物流运输 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) #include<cstdio> #include<iostream> #include<algorit…
2021.11.02 eleveni的水省选题的记录 因为eleveni比较菜,所以eleveni决定从绿题开始水 --实际上菜菜的eleveni连绿题都不一定能水过/忍不住哭了 [P2217 HAOI2007]分割矩阵 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 这道题看着像dfs,实际上就是dfs+dp #include<cstdio> #include<iostream> #include<algorithm> #include<cst…
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a containe…
F - Vasya and Array dp[ i ][ j ] 表示用了前 i 个数字并且最后一个数字是 j 的方案数. dp[ i ][ j ] = sumdp [i - 1 ][ j ], 这样的话会有不合法的方案算进去,而且不合法的方案只有 i - len + 1 到 i 这一段相同才会 出现, 所以如果 i - len + 1 到 i 可以变成一样的话要减去 sumdp[ i - len ] - dp[ i - len ][ j ] #include<bits/stdc++.h> #…
2021.11.05 eleveni的水省选题的记录 因为eleveni比较菜,但是eleveni不想写绿题(总不能说是被绿题虐得不想写),eleveni决定继续水noip原题. --实际上菜菜的eleveni连noip绿题都不一定能水过/忍不住哭了 [P1966 NOIP2013 提高组] 火柴排队 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 本质就是求逆序对的题 #include<cstdio> #include<iostream> #include<…
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a contain…