GukiZ and GukiZiana 题意: 区间加 给出$y$查询$a_i=a_j=y$的$j-i$最大值 一开始以为和论文CC题一样...然后发现他带修改并且是给定了值 这样就更简单了.... 每个块维护排好序的结果 修改暴力重构+整块打标记 查询暴力查+整块二分找数量 复杂度$O(SlogS + \frac{N}{S} + S+\frac{N}{S}logS)$ woc求了一节课导数也没求出最值来又发现一开始式子列错了不管了我就开根号了..(我才不会说是因为乱搞了一下更慢了) 貌似是因为…
Problem E. GukiZ and GukiZiana Solution: 先分成N=sqrt(n)块,然后对这N块进行排序. 利用二分查找确定最前面和最后面的位置. #include <bits/stdc++.h> using namespace std; typedef long long ll; vector<]; ll add[], a[], pos[]; ll n, q, bk, N; bool cmp( int x, int y ) { if( a[x] == a[y]…
题目链接 GukiZ and GukiZiana 题目大意:一个数列,支持两个操作.一种是对区间$[l, r]$中的数全部加上$k$,另一种是查询数列中值为$x$的下标的最大值减最小值. $n <= 500000, q <= 50000$ 我一开始的反应是线段树,然后发现自己完全想错了…… 这道题时限$10$秒,但也很容易超时.我后来是用分块过的. 把序列分成$\sqrt{n}$个块,每个块的大小为$\sqrt{n}$(最后一个块可能因为不能整除的关系可能会小一些) 每个块维护一个值$delt…
E. GukiZ and GukiZiana Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/551/problem/E Description Professor GukiZ was playing with arrays again and accidentally discovered new function, which he called GukiZiana. For given a…
GukiZ and GukiZiana Time Limit: 10000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 551E64-bit integer IO format: %I64d      Java class name: (Any)   Professor GukiZ was playing with arrays again and accidentally di…
time limit per test 10 seconds memory limit per test 256 megabytes input standard input output standard output Professor GukiZ was playing with arrays again and accidentally discovered new function, which he called GukiZiana. For given array a, index…
E. GukiZ and GukiZiana time limit per test 10 seconds memory limit per test 256 megabytes input standard input output standard output Professor GukiZ was playing with arrays again and accidentally discovered new function, which he called GukiZiana. F…
E - GukiZ and GukiZiana 思路:分块, 块内二分 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pi acos(-1.0) #define LL long long //#define mp m…
[codeforces551E]GukiZ and GukiZiana 试题描述 Professor GukiZ was playing with arrays again and accidentally discovered new function, which he called GukiZiana. For given array a, indexed with integers from 1 to n, and number y, GukiZiana(a, y) represents…
BZOJ_3343_教主的魔法_分块+二分查找 题意:教主最近学会了一种神奇的魔法,能够使人长高.于是他准备演示给XMYZ信息组每个英雄看.于是N个英雄们又一次聚集在了一起,这次他们排成了一列被编号为1.2.…….N.每个人的身高一开始都是不超过1000的正整数.教主的魔法每次可以把闭区间[L, R](1≤L≤R≤N)内的英雄的身高全部加上一个整数W.(虽然L=R时并不符合区间的书写规范,但我们可以认为是单独增加第L(R)个英雄的身高)询问WD闭区间 [L, R] 内有多少英雄身高大于等于C,以…