Description There is a river, which contains n stones from left to right. These stones are magic, each one has a magic number Ai which means if you stand on the ith stone, you can jump to (i +1)th stone, (i+2)th stone, ..., (i+Ai)th stone(when i+Ai >…
Just a Hook In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. Now Pudge wants to do some operations on the hook.…
http://acm.uestc.edu.cn/#/problem/show/1057 题意:给你n个数,q次操作,每次在l,r上加上x并输出此区间的sum 题解:线段树模板, #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<stdio.h> using namespace std; ; int a[maxn], n, q, l, r, val; typedef long long ll; struct nod…
题意: T N M N个数 M个操作 一个数组A, 有3个操作 1 l r x,a[l]-a[r]都+x 2 l r,a[i]=sqrt(a[i]),l<=i<=r 3 l r,求和,a[i], l<=i<=r 操作3的时候输出 n,m(1<=n,m<=100000). 1<=A[i],x<=100000. 思路: 前言(读者可略过,看了请小喷qaq,欢迎指出错误): 我突然开始困惑复杂度的问题: 如果区间内所有的数都不相等,那么每次sqrt一下的时间复杂度…