PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#LCA0000037. Giá trị nhỏ nhất trên đoạn nửa mở (Static RMQ)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Giá trị nhỏ nhất trên đoạn nửa mở (Static RMQ)
Static RMQ
Source: Library Checker
Version: Phuoc Hung OJ Extended
Problem Statement
You are given a static array of nonnegative integers. For each query , find the minimum among .
Important: The interval is half-open : index is included but is excluded. Array indices start from .
Input
- First line: .
- Second line: values .
- Next lines: with .
Output
Print the minimum for each query on a separate line.
Subtasks
General constraints (all subtasks): ; ; .
- Subtask 1 (20 points): ; ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; ; .
Examples
Input
4 4
2 10 1 100
0 1
0 3
1 4
3 4
Output
2
1
1
100
Explanation
Range contains only ; contains with minimum ; also has minimum .