#P2843. 暗杀
暗杀
Description
The enemy’s senior generals share many similarities. To more easily find each general’s weakness, our intelligence department has identified their differences and summarized them into types of traits. For example, trait means a general likes to fight, trait means a general likes to eat, and so on.
For storage, we use a trait value to describe a general’s characteristics. The trait value is a binary integer with bits, where each bit can represent one trait of a general. means the general has this trait, and means not.
Our spy has learned that soon enemy generals will hold a banquet, and they will enter in a single file. If among some consecutive people, the number of occurrences of each trait are all the same, then our spy can easily assassinate these people. You need to help determine the maximum number that the spy can assassinate.
Because the spy may be killed right after starting the attack, the spy can attack only once.
Input Format
The first line contains two integers , .
The second line contains integers, where the -th number represents the -th general’s trait value (given in decimal form).
Output Format
Output the maximum number of enemy generals that can be assassinated.
7 3
7 6 7 2 1 4 2
4
Hint
- For 30% of the testdata, .
- For 50% of the testdata, .
- For 100% of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号