分类: 树状数组

5 篇文章

冬日暖心赛 题解
差点翻车系列 A 断章取义 输出第L个到第R个字符串即可 #include <bits/stdc++.h> /* #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/hash_policy.hpp> */ using namespace std; …
区间最值板子
struct BIT { LL h[(int)1e5 + 9], n; void init(int x) { n = x; f(i,1,n)update(i); } void update(int x) { while(x<=n){ h[x]=aa[x]; int low=lowbit(x); for(int i=1;…
Codeforces Round #789 (Div. 2)
降智场 A. Tokitsukaze and All Zero Sequence 条件判断即可 B. Tokitsukaze and Good 01-String 我们应当考虑到每段均应为偶数,所以我们可以两个两个判断。。。 C. Tokitsukaze and Strange Inequality 应当考虑到固定$b,c$来进行循环,可以树状数组…
Codeforces Round #786 (Div. 3)解题报告
读假题,写假题,人麻了 A. Number Transformation 根据题意可以很简单的发现,如果y不能被x整除就输出0 0,否则输出1 $\frac{y}{x}$即可 B. Dictionary 手推一下即有:索引为(s[0]-'a')*25-(s[1]>s[0])+s[1]-'a' C. Infinite Replacement 根…
Codeforces Round #783
D. Optimal Partition 考虑到动态规划有:$dp_i=max\{dp_i,dp_j+i-j\}$其中$(j < i,sum[j] \leqslant sum[i])$,所以我们可以用树状数组维护最大值$dp_i-i$ #include <algorithm> #include <bitset> #in…