#QHD0000030. Oẳn tù tì (Hoof, Paper, Scissors)
Oẳn tù tì (Hoof, Paper, Scissors)
Hoof, Paper, Scissors
Source: USACO
Version: Phuoc Hung OJ Extended
Problem Statement
This package preserves the original task mechanism. Bessie chơi ván Hoof-Paper-Scissors và biết trước nước của đối thủ. Bessie được đổi cử chỉ nhiều nhất lần. Hãy tối đa hóa số ván thắng.
Input
Dòng đầu chứa . Dòng hai chứa số mã hóa đối thủ: 0=Hoof, 1=Scissors, 2=Paper.
Output
In số ván thắng lớn nhất.
Subtasks
- Subtask 1 — 20 points: small data.
- Subtask 2 — 30 points: medium data.
- Subtask 3 — 50 points: full PHOJ package limits.
Examples
Input
5 1
0 1 2 0 1
Output
3
Explanation
The output follows directly from the rules above.