uva 12299 RMQ with Shifts (简单线段树)

传送门:点击打开链接

题目大意:

对一个数组有2种操作。

1:左移,将给定的几个位置左移。

2:求区间最小值。

解题思路:

左移。。。呵呵 么见过。怎么搞。再读读题。然后惊讶的发现。Each operation is formatted as a string having no more than 30 characters

那就好办了。弄成单点更新就OK了!

时间: 2025-01-17 09:56:39

uva 12299 RMQ with Shifts (简单线段树)的相关文章

Uva 12299 RMQ with Shifts(线段树 + 单点更新 )

Uva 12299 RMQ with Shifts (线段树 + 单点更新) 题意: 对于给定的序列 x[i]给出一个操作 shift(a,b,c,d,e) 对应的是将 x[a]与x[b] x[b]与x[c] 这样相邻的两两交换For example, if A={6, 2, 4, 8, 5, 1, 4}then shift(2, 4, 5, 7) yields {6, 8, 4, 5, 4, 1, 2}. After that,shift(1, 2) yields {8, 6, 4, 5, 4

UVa 12299 RMQ with Shifts(移位RMQ)

UVa 12299 - RMQ with Shifts(移位RMQ) Time limit: 1.000 seconds Description - 题目描述 In the traditional RMQ (Range Minimum Query) problem, we have a static array A. Then for each query (L,R) (L ≤ R), we report the minimum value among A[L], A[L + 1], ...,

UVa 12299 RMQ with Shifts(线段树)

线段树,没了.. ----------------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<cctype> #define rep(i,n) for(int i=0;i<n

【UVA】12299-RMQ with Shifts(线段树)

修改的时候由于数据很小,所以可以直接暴力修改,查询的时候利用线段树就行了. 14337858 12299 RMQ with Shifts Accepted C++ 0.282 2014-10-11 16:02:53 #include<cstdio> #include<vector> #include<cstring> #include<algorithm> using namespace std; #define lson pos<<1 #def

HDU 1754 - I Hate It &amp; UVA 12299 - RMQ with Shifts - [单点/区间修改、区间查询线段树]

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1754 Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description 很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少.这让很多学生很反感.不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问.当然,老师

湖南省第七届大学生计算机程序设计竞赛 RMQ with Shifts (线段树)

RMQ with Shifts 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述     In the traditional RMQ (Range Minimum Query) problem, we have a static array A. Then for each query (L, R) (L<=R), we report the minimum value among A[L], A[L+1], -, A[R]. Note that the indic

nyoj 568——RMQ with Shifts——————【线段树单点更新、区间求最值】

RMQ with Shifts 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述     In the traditional RMQ (Range Minimum Query) problem, we have a static array A. Then for each query (L, R) (L<=R), we report the minimum value among A[L], A[L+1], …, A[R]. Note that the indic

UVA12299 - RMQ with Shifts(线段树)

题目链接 题目大意:要求你查询某一段的最小值,但是还有一个shift操作,将(a0, a1, a2, a3..ak)这个K个位置的数字互相对掉,例如a0位置的值变成a1,a1位置的值变成a2...ak位置的值变成a0. 解题思路:因为shift后面的操作数最多30个,所以可以用线段树单点修改.复杂度n*logn.用sscanf函数挺耗时的,还是自己写处理函数. 代码: #include <cstdio> #include <cstring> #include <algorit

csu 1110 RMQ with Shifts (线段树单点更新)

#include <cstdio> #include <cstring> #include <queue> #include <cmath> #include <algorithm> #include <iostream> #include <cstdlib> #define lson l,m,rt<<1 #define rson m + 1,r ,rt<<1|1 using namespace s