Broken Telephone

i don’t understand the second simple.

input:
5
1 3 1 1 1
output:
4
Example 2: First 3 players misheard the message or whispered it wrongly.
help me,thank you.

You are not allowed to ask questions relating to problems from an ongoing contest here on Discuss. You should visit the problem page and leave a comment there.

it’s actually quite simple, i’ll explain this in boolean expression, but maybe you need different kind of approach as the limit is too big for this approach


5 1 3 1 1 1

5->1 both false

1->3 both false, but 1 has been counted

3->1 both false, but 3 has been counted

1->1 both true

1->1 both true

so in the end :
[false] [false] [false] [false] [true] [true]

but that comment can await moderation for even more than 10 days

1 Like

read the problem statement carefully

[CodeChef: Practical coding for everyone]
Whats wrong with this solution after submitting it is showing wrong answer. Anyone please help.