UVALive - 6709】的更多相关文章

题目链接 给一个n*n的方格, 每个方格有值. 每次询问, 给出三个数x, y, l, 求出以x, y为中心的边长为l的正方形内的最大值与最小值, 输出(maxx+minn)/2, 并将x, y这个格子的值改为(maxx+minn)/2.题目保证l为奇数. 二维线段树的单点更新, 区间查询. #include<bits/stdc++.h> using namespace std; #define pb(x) push_back(x) #define ll long long #define m…
二维线段树单点修改板子题 #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define pii pair<int,int> #define piii pair<int, pair<int,int>> using namespace std; +; ; const int inf=0x3f3f3f3f; c…
题意:给你一个矩阵,q次操作,每次查询长宽l的矩阵最大值a和最小值b,然后把中间点换成floor((a+b)/2), 解法:暴力可过,建n颗线段树暴力更新,但是正解应该是树套树,树套树需要注意的是当建树或修改时pushup操作不能直接搞,要先判断是不是外面层的叶子节点,如果是直接修改,如果不是,应该是从外面层的对应子节点更新过来,因为此时的外层树维护的是x轴区间最大和区间最小,需要从x轴两个更小的区间树合并起来更新 //#pragma comment(linker, "/stack:200000…
UVALive - 4108 SKYLINE Time Limit: 3000MS     64bit IO Format: %lld & %llu Submit Status uDebug Description   The skyline of Singapore as viewed from the Marina Promenade (shown on the left) is one of the iconic scenes of Singapore. Country X would a…
UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device with a variable electric resistance. It has two terminals and some kind of control mechanism (often a dial, a wheel or a slide) with which the resistance…
UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here comes a problem about words. Know- ing that Ray has a photographic memory and this may not trouble him, Neal gives it to Jiejie. Since Jiejie can’t remem…
题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000即为距离: 详细解释:http://www.cnblogs.com/zywscq/p/4268556.html */ #include <cstdio> #include <iostream> #include <algorithm> #include <cmath&…
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4156 题目拷贝难度大我就不复制了. 题目大意:维护一个字符串,要求支持插入.删除操作,还有输出第 i 次操作后的某个子串.强制在线. 思路1:使用可持久化treap可破,详细可见CLJ的<可持久化数据结构的研究>. 思路2:rope大法好,详见:http…
Permutation Graphs Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVALive 6508 #include<stdio.h> #include<string.h> ],a[],b[],c[],b1[]; long long num; void merg_sort(int a[],int l,int r) { int…
Boxes Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVALive 6500 #include<stdio.h> #include<string.h> int main() { int T,m,n; int i,j,s; ][]; scanf("%d",&T); while(T--) { s=; sc…