NC222502. [USACOOpen2020S]TheMooParticle
描述
输入描述
The first line contains a single integer N, the initial number of moo particles. Each of the next N lines contains two space-separated integers, indicating the spin of one particle. Each particle has a distinct spin.
输出描述
A single integer, the smallest number of moo particles that may remain after some arbitrary sequence of interactions.
示例1
输入:
4 1 0 0 1 -1 0 0 -1
输出:
1
说明:
One possible sequence of interactions:示例2
输入:
3 0 0 1 1 -1 3
输出:
2
说明:
Particle 3 cannot interact with either of the other two particles, so it must remain. At least one of particles 1 and 2 must also remain.