Creating Fake News
Time limit2sMemory limit512 MB
Find one story vector satisfying n linear equations, then the minimum number of starting people whose reach covers all n people.
Problem
A social network has people, numbered 1 to . One news story is described by real numbers , where says how hard the story pushes topic . These numbers do not have to be integers.
Person comes with an interest vector and a threshold . Person likes a story exactly when . A sum above the threshold is no better than a sum below it, so only an exact match works.
Someone who receives the story and likes it passes it on to everyone on their share list. Someone who does not like it passes it to nobody. You pick the people who receive the story first, and you may pick several, but every one of them gets the same single story.
Design one story that all people like. Such a story does not always exist, and you report that when it happens. When it does exist, report the smallest number of people you have to start the story at so that every person receives it.
Input
The first line holds the number of data sets . After it come data sets.
The first line of a data set holds the number of people and the number of topics . Each of the next lines describes one person: line holds the integers , then the threshold , then the size of the share list, then the numbers of the people person sends news to.
, , , , , and . The numbers on a share list are distinct and never include .
Output
For each data set, print Data Set x: on a line by itself, where is the number of the data set counting from 1. On the next line print the smallest number of people you have to start the story at so that everyone receives it, or Impossible when no story satisfies all people. Print a blank line after each data set.