#CCBCHBA0000022. Vị trí đầu tiên của cực đại (First Position of Maximum)
Vị trí đầu tiên của cực đại (First Position of Maximum)
First Position of Maximum
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Find the maximum value and its first 1-based position. Do not replace the position when a later element ties the maximum.
Input
n in [1,100000], followed by n integers in [-1000000,1000000].
Output
Maximum value and first 1-based position on one line.
Subtasks
- Subtask 1 (20%): , .
- Subtask 2 (30%): , .
- Subtask 3 (50%): , .
Examples
Example 1
Input
5
3 8 1 8 7
Output
8 2
Explanation
8 appears at positions 2 and 4, so keep 2.
Example 2
Input
1
-10
Output
-10 1
Explanation
A single negative value is also the maximum.