RoAlgo Contest #8 | Mini SuperLiga

This was the problem page during the contest. Access the current page here.
Time limit: 1s Memory limit: 32MB Input: Output:

Attention — This is the easy version of the problem SuperLiga.

Task

A ranking line of the form (M,V,E,I,P)(M, V, E, I, P) — (matches, victories, draws, defeats, points) is given, this ranking line corresponding to the results of a team throughout a competitive season in a football league in Southeast Europe.

Now B.B.C, a specialist in the field, wants to know if the given configuration is valid according to football rules (33 points for a victory, 11 point for a draw, 00 points for defeats).

Input data

The first line will contain the number of tests TT.

Each of the next TT lines will contain a configuration in the format described in the statement, each of the 5 positions containing a natural number representing the corresponding number for that position.

Output data

Each line will contain YES if the configuration is correct, or NO otherwise.

Constraints and clarifications

  • 1T1051 \leq T \leq 10^5
  • 0M,V,E,I,P1060 \leq M, V, E, I, P \leq 10^6
# Score Constraints
1 0 Example
2 50 M,V,E,I,P200M, V, E, I, P \leq 200
3 50 No additional constraints

Example

stdin

10
11 8 1 2 25
9 4 4 3 16
5 0 5 0 5
58 28 10 20 94
10 4 0 6 12
685 684 0 1 2052 
10 4 3 3 15
10 1 3 6 5
6 0 3 3 3 
11 1 8 2 10

stdout

YES
NO
YES
YES
YES
YES
YES
NO
YES
NO

Explanation

For example, in the last test, the number of points obtained is 1111, not 1010.

Log in or sign up to be able to send submissions!