|
||||||||||
Eighty sevenTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 2800 Accepted Submission(s): 832 Problem Description Mr. Fib is a mathematics teacher of a primary school. In the next lesson, he is planning to teach children how to add numbers up. Before the class, he will prepare $N$ cards with numbers. The number on the $i$-th card is $a_i$. In class, each turn he will remove no more than $3$ cards and let students choose any ten cards, the sum of the numbers on which is $87$. After each turn the removed cards will be put back to their position. Now, he wants to know if there is at least one solution of each turn. Can you help him? Input The first line of input contains an integer $t~(t \le 5)$, the number of test cases. $t$ test cases follow. For each test case, the first line consists an integer $N(N \leq 50)$. The second line contains $N$ non-negative integers $a_1, a_2, ... , a_N$. The $i$-th number represents the number on the $i$-th card. The third line consists an integer $Q(Q \leq 100000)$. Each line of the next $Q$ lines contains three integers $i,j,k$, representing Mr.Fib will remove the $i$-th, $j$-th, and $k$-th cards in this turn. A question may degenerate while $i=j$, $i=k$ or $j=k$. Output For each turn of each case, output 'Yes' if there exists at least one solution, otherwise output 'No'. Sample Input
Sample Output
Source | ||||||||||
|