題意:長度為n的序列,初始都是0,維護3個操作:
there are three types of operations:
1. 1 l r w, for each index i ∈ [l,r], change ai to ai + w.
2. 2, change a to its prefix sum array. i.e., let a' be a back-up of a, for each i ∈ [1,n], change ai to .
3. 3 l r, query for the interval sum
.題解:
補充:j位置在i位置後面,組合數的得來類似走網格的方案數
下個結論借助字首和差分的思想
**:
1 #include2 #include3 #include4 #include5 #include6 #include7 #include8 #include9 #include10using
namespace
std;
11 typedef long
long
ll;12
const ll mod = 998244353;13
const
int n=200005;14
ll fact[n], ifact[n], inv[n];
1516
void
init()
25ll c(ll a,ll b)
2630
struct
node;
3435
intmain()
36);
56 vt.push_back((node));57}
58else
if(op==2) tot++;
59else
6073
if(vt[i].pos<=r)
7478
}79 printf("
%lld\n
",(sumr-suml+2ll*mod)%mod);
8081}82
}83}84
}85
2019牛客多校第十場
對於s n s n s n 考慮某個字母是從s n 1 s n 1 s n 1 轉移還是從s n 2 s n 2 s n 2 轉移 include define fo i,a,b for i a i b i define n 10005 using namespace std int t,n,q,p...
2020牛客多校第十場 A
x 是乘法 以任意點為起點,一直以 2 x now p 第一類 做的話 或者3 x now p 第二類 會形成乙個或者多個環。環上有什麼特點。對於 某個數z,它所對應的後一位是y,當 2 x z p 3 x z p 相等的時候,這兩類的環在z後面的數y時一樣的。但是 上式化簡 2 x z n x p...
19牛客多校第十場G
之前gym做過乙個畫圓的。然後這個也想畫圓。算了算複雜度n 3logn還蠻好。卡常卡了3個小時投降了。學藝不精啊。賽後去看了qls的 學到了神奇的優化技巧。比如我們要check點到直線的距離是否大於等於二分的半徑r。我們可以直接用叉積判,而不是算投影。我覺得最大的優化就在這了,理論上省了一半多常數。...