Pop Quiz!

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Suddenly, a wild Derek emerges from the shadows and surprises a student with a pop quiz! Derek asks the student N multiplication questions, and if the student gets all the questions right, Derek awards the student with a whole chocolate bunny.

Input Specification

The first line of input contains one integer, N, the number questions Mateo asked

The next N lines contain three integers A, B and P, being the multiplicand, multiplier and the student's product, respectively.

Output Specification

Output PERFECT if the student got everything right, or IMPERFECT if he did not.

Contraints

1 \le N \le 100 000
1 \le A \le 500
1 \le B \le 500
1 \le P \le 1 000 000

Sample Input 1

3
2 5 10
4 6 24
10 7 70

Sample Output 1

PERFECT

Sample Input 2

5
123 43 5289
23 343 7315
1 34 34
500 500 250000
2 5 10

Sample Output 2

IMPERFECT

Explanation for Sample Output 2

The second question was answered incorrectly. 23x343 is 7889, not 7315, so the quiz was imperfect


Comments

There are no comments at the moment.