ACM-ICPC國際大學生程序設計競賽北京賽區(2017)網絡賽 hihocoder #1586 : Minimum-區間查詢最值求區間兩數最小乘積+單點更新-線段樹(結構體版)
阿新 • • 發佈:2018-06-04
ns2 edit AD memory body bmi json ffffff inf
#1586 : Minimum
Time Limit:1000ms Case Time Limit:1000ms Memory Limit:256MBDescription
You are given a list of integers a0, a1, …, a2^k-1.
You need to support two types of queries:
1. Output Minx,y∈[l,r] {ax?ay}.
2. Let ax=y.
Input
The first line is an integer T, indicating the number of test cases. (1≤T≤10).
For each test case:
The first line contains an integer k (0 ≤ k ≤ 17).
The following line contains 2k integers, a0, a1, …, a2^k-1 (-2k ≤ ai < 2k).
The next line contains a integer (1 ≤ Q < 2k), indicating the number of queries. Then next Q lines, each line is one of:
1. 1 l r: Output Minx,y∈[l,r]{ax?ay}. (0 ≤ l ≤ r < 2k)
2. 2 x y: Let ax=y. (0 ≤ x < 2k, -2k ≤ y < 2k)
Output
For each query 1, output a line contains an integer, indicating the answer.
- Sample Input
-
1 3 1 1 2 2 1 1 2 2 5 1 0 7 1 1 2 2 1 2 2 2 2 1 1 2
- Sample Output
-
1 1 4
ACM-ICPC國際大學生程序設計競賽北京賽區(2017)網絡賽 hihocoder #1586 : Minimum-區間查詢最值求區間兩數最小乘積+單點更新-線段樹(結構體版)