|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||0||0||0||0.000%|
Picking the right size of your cap is surprisingly difficult. If your cap is too small, it keeps digging into your head, or — even worse — you can’t even get it over your computer science filled head. And if it is too large, it keeps wiggling, and you know that it will just fall down or be blown away by the wind at the most solemn and important moment. So before committing to a cap size, you tried on several different caps, and recorded how they fit: some might have been too large, some too small, and if you were lucky, one might even have fit perfectly. After trying on some (but maybe not all) caps, you now want to compute how many caps could possibly still fit you perfectly.
The first line contains a number 1 ≤ K ≤ 100, which is the number of input data sets in the file. This is followed by K data sets of the following form:
The first line of a data set contains two integers n, t with 0 ≤ t ≤ n ≤ 100: n is the number of caps that are available, and t is the number you tried on. This is followed by a line with n integers 0 ≤ si ≤ 1000, giving you the size of the ith cap. They will be given in strictly increasing order (which also means that the same cap size never appears twice).
Next are t lines, each with two integers ci, fi, where 0 ≤ ci ≤ 1000 and −1 ≤ fi ≤ 1. Here, ci is the size of the cap you tried on (which will always be a size occuring in the earlier list of all sizes), and fi the fit, where fi = −1 means it was too large, fi = 0 that it fit perfectly, and fi = 1 that it was too small.
For each data set, first output “Data Set x:” on a line by itself, where x is its number. Then, output the number of caps that might still fit you perfectly based on the information you received. If the input claimed that a large cap was too small and a smaller cap was too large, or that two different cap sizes fit perfectly, then output “Inconsistent feedback” instead.
5 4 2 1 4 7 10 1 1 10 -1 3 1 1 4 5 4 0 3 2 1 2 3 1 -1 2 1 3 2 1 5 8 1 1 5 -1 3 2 1 4 9 1 0 9 0
Data Set 1: 2 Data Set 2: 1 Data Set 3: Inconsistent feedback Data Set 4: 0 Data Set 5: Inconsistent feedback