PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#PS0000272. Cập nhật hình hộp bằng sai phân 3D (3D Cuboid Updates)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Cập nhật hình hộp bằng sai phân 3D (3D Cuboid Updates)
3D Cuboid Updates
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
An array is initially zero, with 1-based indices. Each operation adds integer to every cell with , , . Print the final array.
Input
First line: . Next lines: .
Output
Print integers on one line, in increasing , then increasing , then increasing .
Subtasks
- Subtask 1 (20 points): ; ; ; ; ; .
- Subtask 2 (30 points): ; ; ; ; ; .
- Subtask 3 (50 points): ; ; ; ; ; .
Example 1
Input
1 1 2 1
1 1 1 1 1 2 3
Output
3 3
Explanation
Both cells receive 3.
Example 2
Input
2 1 2 2
1 1 1 2 1 2 5
2 1 2 2 1 2 -7
Output
5 5 5 -2
Explanation
First add 5 to all four cells, then subtract 7 only at , giving -2 there.