#CCBCHBAHAI0000061. Vị trí số khác 0 đầu tiên và cuối cùng (First and Last Nonzero Positions)
Vị trí số khác 0 đầu tiên và cuối cùng (First and Last Nonzero Positions)
First and Last Nonzero Positions (Vị trí số khác 0 đầu tiên và cuối cùng)
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given , define
If is nonempty, print and . If is empty, print -1 -1. Indices are 0-based.
Input
The first line contains . The second line contains integers .
Output
Print L R as defined.
Subtask
Subtask 1 (20 points): , .
Subtask 2 (30 points): , .
Subtask 3 (50 points): , .
Example
Input
7
0 0 5 0 -2 0 0
Output
2 4
Explanation
The sample follows the definitions and rules above.