#CCBCHBAHAI0000097. Suy kích thước mảng khi bỏ size trong declaration
Suy kích thước mảng khi bỏ size trong declaration
Inferring Array Size from an Omitted Size
Source: Phuoc Hung OJ
Version: Phuoc Hung OJ Extended
Problem
Consider a C array declaration whose size is omitted:
int a[] = {v0, v1, ..., v(n-1)};
The initializer list contains exactly elements. Therefore the inferred array size is
and, with 0-based indexing, the valid index set is
Output the inferred size and the largest valid index.
Input
The first line contains . The second line contains exactly initializer values.
Output
Print and .
Subtask
Subtask 1 (20 points): .
Subtask 2 (30 points): .
Subtask 3 (50 points): .
Example
Input
5
7 2 9 -1 4
Output
5 4
Explanation
There are 5 initializer elements, so the inferred size is 5 and the last valid index is 4.