[POJ3264]Balanced Lineup
题意
给一个数列,求数列中$l,r$范围内最大值和最小值的差。
题解
st表模板题。求两次rmq即可。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include
#include
#include
#include
using
#define
#define
#define
#define
typedef
typedef
const
//head
const
int
int
int
int
int
int
rep(i,0
rep(j,0
st[i][j+1
st2[i][j+1
}
}
int
int
return
}
int
int
return
}
int
#ifdef
freopen("shui.in"
#endif
while
rep(i,0
ST();
while
int
l--,r--;
printf
}
}
return
}
[POJ3264]Balanced Lineup
https://www.cheasim.com/acm/2018/08/24/POJ3264-Balanced-Lineup.html
作者 CheaSim
发布于 2018-08-24
更新于 2018-08-24
许可协议
#acm