problem1 link 计算每个格子向上的最大高度.然后每个格子同一行前面的格子以及当前格子作为选取的矩形的最后一行,计算面积并更新答案. problem2 link 对于两个数据$(x_{1},y_{1}),(x_{2},y_{2})$,若先完成第一个再完成第二个,那么一开始的值$F$需要满足$F\geq max(x_{1}, x_{2}+(x_{1}-y_{1}))$,反过来需要满足$F\geq max(x_{2}, x_{1}+(x_{2}-y_{2}))$.所以若前者更优的话,那么有…
problem1 link 倒着想.每次添加一个右括号再添加一个左括号,直到还原.那么每次的右括号的选择范围为当前左括号后面的右括号减去后面已经使用的右括号. problem2 link 令$h(x)=\sum_{i=1}^{x}g(i)$,那么答案为$h(R)-h(L-1)$.对于$h(x)$: (1)如果$x\leq K$,那么$h(x)=0$ (2)否则对于$[K+1,x]$之间的所有偶数来说,对答案的贡献为$even+h(\frac{x}{2})-h(\frac{K}{2})$,其中$e…
Problem Statement You are given the ints perimeter and area. Your task is to find a triangle with the following properties: The coordinates of each vertex are integers between 0 and 3000, inclusive. The perimeter of the triangle must be exactly…
div1 250pt: 题意:100*100的01矩阵,找出来面积最大的“类似国际象棋棋盘”的子矩阵. 解法:枚举矩阵宽(水平方向)的起点和终点,然后利用尺取法来找到每个固定宽度下的最大矩阵,不断更新答案. // BEGIN CUT HERE // END CUT HERE #line 5 "TheMatrix.cpp" #include<cstdio> #include<sstream> #include<cstring> #include<…
Problem Statement The Happy Letter game is played as follows: At the beginning, several players enter the field. Each player has a lowercase English letter on their back. The game is played in turns. In each turn, you select two players with dif…