CBOJ Welcome Contest Problem 1 - Symmetric Encryption


Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 128M

Author:
Problem types

Bob just received an encrypted message!

The original message was composed using \(3\) integers, with \(3\) additional integers used to scramble the original. The order of the \(6\) integers are shuffled afterwards. There is one special property: the sum of the 3 original integers is equal to the sum of the 3 added integers. Note that the order of the original message does not matter.

However, it is just as likely that the encrypted message was encrypted incorrectly and the original message can't be recovered.

Given Bob's \(6\) integers, can Bob's original message potentially be recovered? Output YES if it can and NO otherwise.

Input Specification

The first line of the input will contain \(6\) integers ranging from \(0\) to \(10\) inclusive, representing the encrypted message.

Output Specification

On a single line, output YES if the original message can potentially be recovered and NO otherwise.

Scoring

Your code will be graded against all \(16\) testcases. Your in-contest score will be equal to \(100 \cdot \frac{x}{16}\), where \(x\) is the number of cases that have successfully passed.

Sample Input 1

0 1 1 0 2 0

Sample Output 1

YES

Sample Explanation 1

The original message can be either \(\{1, 1, 0\}\) or \(\{0, 2, 0\}\). Note that the order of the integers in the message does not matter.

Sample Input 2

0 1 1 0 4 0

Sample Output 2

NO

Sample Explanation 2

There are no possible combinations of the \(6\) integers that make the decryption possible.


Comments

There are no comments at the moment.