PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#TP0000071. Biến đổi mảng: độ tăng nhỏ nhất và lớn nhất (Min-Max Array Transformation)
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: độ tăng nhỏ nhất và lớn nhất (Min-Max Array Transformation)
Min-Max Array Transformation
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Two sorted nondecreasing arrays are given. Nonnegative additions are applied to , and the resulting values are sorted into . Find the minimum and maximum feasible for each index independently.
Input
Line 1: . Lines 2–3: sorted arrays , each of length . Exactly one case; no .
Output
Print two lines of integers: independent minima and maxima.
Subtasks
- Subtask 1 (20 points): Exactly one dataset; ; ; both arrays nondecreasing; a feasible nonnegative increment assignment exists.
- Subtask 2 (30 points): Exactly one dataset; ; ; both arrays nondecreasing; a feasible nonnegative increment assignment exists.
- Subtask 3 (50 points): Exactly one dataset; ; ; both arrays nondecreasing; a feasible nonnegative increment assignment exists.
Example
Input
3
2 3 5
7 11 13
Output
5 4 2
11 10 8
Explanation
The first feasible b-value for a=2,3,5 is 7,7,7. Maximum feasible increment independently uses value 13 in all three positions.