#CCBCHHAI0000007. Lựa chọn trong 1..3 (First Choice from One to Three)
Lựa chọn trong 1..3 (First Choice from One to Three)
First Choice from One to Three
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read choice codes until the first code in 1, 2, 3. Ignore other codes; output the first valid code and the total number of values read, including the successful read.
Input
A sequence of integers; the last is in and no preceding number is in .
Output
Print two integers on one line: the first valid code and the number of reads, separated by one space.
Subtasks
- Subtask 1 (20%): At most 5 values; each value has absolute value at most 10.
- Subtask 2 (30%): At most 100 values; each value has absolute value at most 1000.
- Subtask 3 (50%): At most 100001 values; each value has absolute value at most 1000000.
Examples
Example 1
Input
0 5 2
Output
2 3
Explanation
Zero and five are invalid; two is first valid on the third read.
Example 2
Input
3
Output
3 1
Explanation
Three is valid on the first read, so the count is one.