PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SRD0000028. Nghịch thế trong đoạn tĩnh (Static Range Inversions Query)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Nghịch thế trong đoạn tĩnh (Static Range Inversions Query)
Static Range Inversions Query
Source: Library Checker
Version: Phuoc Hung OJ Extended
Problem Statement
Given an immutable nonnegative array , answer range inversion queries. For each half-open interval , count pairs for which . Equal values are not inversions.
Input
The first line contains , followed by the array values. Each of the following lines contains .
Output
Print each query answer as a 64-bit integer, in input order.
Subtasks
- Subtask 1 (10 points): ; ; ; . There are no updates.
- Subtask 2 (20 points): ; ; ; . There are no updates.
- Subtask 3 (30 points): ; ; ; . There are no updates.
- Subtask 4 (40 points): ; ; ; . There are no updates.
Examples
Input
4 2
4 1 4 0
1 3
0 4
Output
0
4
Explanation
The subarray has no inversion. The whole array has four: index pairs , , , and .