一道模拟题。 思路 最短的路线是直接竖着走下来,经过 n n n 个格子,所以 k k k 最小是 n n n。如果想要延长路线,可以采用九转大肠的形状,就像这样: 可以发现,每次向左走之后都必须走回来,所以每次新经过的格子数是偶数,得到 k − n k-n k−n 是偶数才有可行的方案。 首先,把整张图表的初始状态设为如下形式(即每个格点都是独立的): +++++S++o|o|o
原题链接:G - Add and Multiply Queries 题意:给出数组a和b,三种操作,第一种:以 1 i x 的形式给出。用x替换ai。第二种:以 2 i x 的形式给出。用x代替 bi 。第三种:以3 l r的形式给出,初始值为0,从l到r每个位置上可以选择加上a[i],或者乘上b[i],输出最大值。 思路:链表+set+树状数组+二分。题目中给出了答案的范围不会超过1e1
atcoder ABC 359-B题详解 Problem Statement There are 2N people standing in a row, and the person at the i-th position from the left is wearing clothes of color Ai. Here, the clothes have N colors from 1
atcoder ABC 359-A题详解 Problem Statement You are given N strings. The i-th string Si(1≤i≤N) is either Takahashi or Aoki. How many i are there such that Si is equal to Takahashi? Constraints 1≤N≤10
题意 AtCoder ABC 365G Freestyle 题解 考虑任两种操作 ( A i , B i ) (A_{i},B_{i}) (Ai,Bi)和 ( A j , B j ) (A_{j},B_{j}) (Aj,Bj),则他们的任意组合可以表示为 ( t A i + ( 1 − t ) A j , t B i + ( 1 − t ) B j ) \big(tA_{i}+(1-
atcoder ABC 358-B题详解 Problem Statement At the entrance of AtCoder Land, there is a single ticket booth where visitors line up to purchase tickets one by one. The purchasing process takes A seconds p
atcoder ABC 357-C题详解 Problem Statement For a non-negative integer K, we define a level-Kcarpet as follows: A level-0 carpet is a 1×1 grid consisting of a single black cell. For K>0, a level-K carp
link 其实是我之前写的一篇博客的推广 大意: 一个阶梯型,第 i i i行有 ⌈ i / 2 ⌉ ∗ 2 \left \lceil i/2 \right \rceil*2 ⌈i/2⌉∗2个方块,总共有n行。在其中给定 m m m个点无法经过,求从左上角到右下角的方案数。其中每次移动只能向右或向下 N ≤ 2.5 e 5 , M ≤ 50 N\leq 2.5e5,M\leq 50 N≤2.5
A - Partition Problem Statement You are given integers N N N and K K K. The cumulative sums of an integer sequence X = ( X 1 , X 2 , … , X N ) X=(X_1,X_2,\dots ,X_N) X=(X1,X2,…,XN) of length