GCD Array Time Limit: 11000/5500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 843 Accepted Submission(s): 205 Problem Description Teacher Mai finds that many problems about arithmetic function can be reduced to…
This problem can be solve in simpler O(NsqrtN) solution, but I will describe O(NlogN) one. We will solve this problem in offline. For each x (0 ≤ x < n) we should keep all the queries that end in x. Iterate that x from 0 to n - 1. Also we need to kee…
D. Petya and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Petya has an array aa consisting of nn integers. He has learned partial sums recently, and now he can calculate the sum o…
题意: 给出一个数组,元素有正有负有0,问其区间和小于 t 的子区间的个数. sum[ r ]-sum[ l-1 ]<t,其中sum是a的前缀和. 实现的方法就是从前往后对于每一个sum[ i ],看在它前面有多少个大于等于sum[ i ] - t 的前缀和. 树状数组维护的是 i 前面有几个数小于等于它 #include <cstdio> #include <cstring> #include <queue> #include <cmath> #in…
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has an array consisting o…
我们知道我们利用树状数组维护的是存到其中的a[ ]数组,但是我们做题需要的是sum[ ]数组,这才是我们真正需要的有用的信息,写这篇博客的目的便是整理一下sum数组是怎么样来应用解题的. 1. Stars Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a st…
题目链接:https://vjudge.net/problem/FZU-2013 Problem 2013 A short problem Accept: 356 Submit: 1083Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description The description of this problem is very short. Now give you a string(length N), an…
D. 80-th Level Archeology time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Archeologists have found a secret pass in the dungeon of one of the pyramids of Cycleland. To enter the treasury t…
比较友好的数据结构题 建议读者好好思考思考--. 可以分析出与前缀和的关系, 之后就愉快的套起树状数组辣 #include <cstdio> #include<queue> #include<cstring> #include<cmath> #include<algorithm> using namespace std; const int N=200000+3; long long C[6][N]; int x[N],v[N],A[N], n;…
好思路,好思路... 思路:前缀异或差分 提交:1次 题解:区间修改,单点查询,树状数组,如思路$qwq$ #include<cstdio> #include<iostream> using namespace std; #define R register int #define ull unsigned long long #define ll long long #define pause (for(R i=1;i<=10000000000;++i)) #define…