Problem G. Duizi and Shunzi
时间限制 3000 ms
内存限制 32 MB
Nike likes playing cards and makes a problem of it.
Now give you n integers, $a_i (1 \le i \le n) $
We define two identical numbers (eg: $ 2,2 $) a Duizi,
and three consecutive positive integers (eg: $ 2,3,4 $) a Shunzi.
Now you want to use these integers to form Shunzi and Duizi as many as possible.
Let s be the total number of the Shunzi and the Duizi you formed.
Try to calculate $max(s)$.
Each number can be used only once.
输入数据
输出数据
For each test case, output the answer in a line.
样例输入
复制
7
1 2 3 4 5 6 7
9
1 1 1 2 2 2 3 3 3
6
2 2 3 3 3 3
6
1 2 3 3 4 5
样例输出
样例说明
Case 1(1,2,3)(4,5,6) Case 2(1,2,3)(1,1)(2,2)(3,3) Case 3(2,2)(3,3)(3,3) Case 4(1,2,3)(3,4,5)
$ Mathjax font initiator $