题目: 问题描述 : Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.In the field of Cyberground, the position of each toy is fixed, and the ring is carefully designe…
Codeforces 848C Goodbye Souvenir Problem : 给一个长度为n的序列,有q个询问.一种询问是修改某个位置的数,另一种询问是询问一段区间,对于每一种值出现的最右端点的下标与最左端点的下标的差值求和. Solution : 定义pre[i] 为 第i个位置的数字上一次出现位置,对于询问l, r 就是对于所有满足 l <= pre[i] < i <= r 的点求和,权值为 i - pre[i]. 因此可以把这个看作是三维偏序的问题,第一维时间,第二维,第三…