PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SRD0000029. Biến đổi mảng theo truy vấn (Array Transformer)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Biến đổi mảng theo truy vấn (Array Transformer)
Array Transformer
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
You are given an array , a positive integer , and transformation instructions. Each instruction acts on the current array:
- Count elements in inclusive interval that are strictly less than .
- Assign $A_p=\left\lfloor\dfrac{u\cdot k}{R-L+1}\right\rfloor$.
The updated position may lie inside or outside . Print the final array after all instructions.
Input
The first line contains . The next values describe . Each of the following lines contains .
Output
Print exactly lines; line contains the final value of .
Subtasks
- Subtask 1 (10 points): ; ; ; initially ; ; ; . Values resulting from updates may be zero.
- Subtask 2 (20 points): ; ; ; initially ; ; ; . Values resulting from updates may be zero.
- Subtask 3 (30 points): ; ; ; initially ; ; ; . Values resulting from updates may be zero.
- Subtask 4 (40 points): ; ; ; initially ; ; ; . Values resulting from updates may be zero.
Examples
Input
10 1 11
1
2
3
4
5
6
7
8
9
10
2 8 6 10
Output
1
2
3
4
5
6
7
8
9
6
Explanation
The sample examines with threshold and finds four smaller values . Since and the interval length is , assign . All other positions remain unchanged.