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…
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…
problem1 link 首先使用两个端点颜色不同的边进行连通.答案是$n-1-m$.其中$m$是联通分量的个数. problem2 link 首先构造一个最小割的模型.左边的$n_{1}$个点与源点相连,右边的$n_{2}$个点与汇点相连.每个中间点最少有$d+1$条边(有一条到汇点/源点的边).最小割为$ans$. 假设有$x$个割边出现在源点和$n_{1}$之间,那么$y=ans-x$个出现在$n_{2}$和汇点之间.其中$x,y$应该满足的关系为$0\leq y=ans-x \leq…