F. Features Track Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat movement from a cat video. To do this, he extracts cat features in each frame. A cat feature is a two-dimension vector <xx, yy>. If x_ixi…
262144K   Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat movement from a cat video. To do this, he extracts cat features in each frame. A cat feature is a two-dimension vector <x, y>. If xi​= xj​ and yi…
https://nanti.jisuanke.com/t/31458 题意 有N个帧,每帧有K个动作特征,每个特征用一个向量表示(x,y).两个特征相同当且仅当他们在不同的帧中出现且向量的两个分量分别相等.求最多连续相同特征的个数? 分析 用一个map来维护帧中特征的信息,map中的键即读入的向量,因此用一个pair<int , int>表示. 键的值也是一个pair,需要记录它当前已经连续了多少次,还需要记录它上一次出现的帧的位置.如果它上一帧没有出现过,那么它的连续次数就要被置成1:如果上…
H.Ryuji doesn't want to study 27.34% 1000ms 262144K   Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, each book has its knowledge a[i]a[i]. Unfortunately, the longer he learns, the fewer he gets. That…
签到题 因为一个小细节考虑不到wa了两次 // 一开始没这个if wa了.因为数据中存在同一帧(frame)一个相同的值出现多次,这样子同一个i 后面的同样的特征会把len重置为1 #include <bits/stdc++.h> using namespace std; typedef long long ll; int t; int n; struct val { int last; int len; void update(int t) { if (t == last + 1) ++le…
https://nanti.jisuanke.com/t/31460 题意 两个操作.1:查询区间[l,r]的和,设长度为L=r-l+1, sum=a[l]*L+a[l+1]*(L-1)+...+a[r].2:将第a个位置修改为b. 分析 变形一下,sum=a[l]*(r-l+1)+a[l+1]*(r-(l+1)-1)+...+a[r](r-r+1)=(r+1)*a[l]-a[l]*l.因此,可维护两个树状数组计算.至于更新操作,实质就是看变化前后的差值,变大就相当与加上差值,否则就是减.注意用…
题意:给你数组a,有两个操作 1 l r,计算l到r的答案:a[l]×L+a[l+1]×(L−1)+⋯+a[r−1]×2+a[r] (L is the length of [ l, r ] that equals to r - l + 1),或者 2 i b:把第i个换成b 思路:用一个树状数组存i的前缀和,再用一个树状数组存(n - i + 1)*a[ i ]的前缀和,这样算出后面那个的区间差减去前一个的区间差的某个倍数就会成为答案. 代码: #include<queue> #include…
任意门:https://nanti.jisuanke.com/t/31459 There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ) means the wave is a rectangle whose vertexes are ( 00 , 00 ), ( xx , 00 ), ( 00 , yy ), ( xx , yy ). Every ti…
Output For each question, output one line with one integer represent the answer. 样例输入 5 3 1 2 3 4 5 1 1 3 2 5 0 1 4 5 样例输出 10 8两个树状数组一个维护a[i]前缀合,一个维护(n-i+1)*a[i]前缀和. #include <iostream> #include <algorithm> #include <cstring> #include &l…
题目链接:https://nanti.jisuanke.com/t/A2007 题目大意:有一个序列含有n个数a[1],a[2],a[3],……a[n],有两种操作: 第一种操作:k=1,l,r,询问区间[l,r]中a[l]*len+a[l+1]*(len-1)+a[l+2]*(len-2)……+a[r]*1,其中len=(r-l+1),即区间长度 第二种操作:k=2,  l,r将下标为l的值a[l]修改为r 一共有q个询问,对于每个询问,如果k==1,输出答案即可. 解题思路:先进行一个小小的…