import java.io.BufferedInputStream; import java.util.*; import java.util.stream.IntStream; public class MetroQuizPabloFaster { private final int N, M; private final long ALL; private final List metroLineStops; private final HashMap dp; private final HashMap count; MetroQuizPabloFaster(int N, int M, List metroLineStops) { Objects.requireNonNull(metroLineStops); this.N = N; this.ALL = (1l<(); count = new HashMap<>(); // precompute probabilities of a state being reachable (just count of how many of the lines) for (var s : metroLineStops) { for (long asked = 0; asked < ALL; asked++) { var answeredYes = asked & s; // we answer truthfully var state = (asked<>N); long answeredYes = (state)&ALL; long countState = count.get(state); if (countState <= 1) return 0.0; // done if (countState == 2) return 1.0; double current = countState - 1.0; // worst case we eliminate one possibility per question for (int i = 0; i < N; i++) { var station = 1l << i; if ((station & asked) > 0) continue; long askedAfter = asked | station; long stateYes = (askedAfter<= current) continue; next += ((countState - countY) * solve(stateNo))/countState; if (next < current ) { current = next; } } dp.put(state,current); return current; } public static void main(String[] args) { Scanner scanner = new Scanner(new BufferedInputStream(System.in)); int N = Integer.parseInt(scanner.nextLine()); int M = Integer.parseInt(scanner.nextLine()); var list = IntStream.range(0,M) .mapToObj(__-> Arrays.stream(scanner.nextLine().split("\s+")) .map(Long::parseLong) .skip(1) // skip number of entries per line .reduce(0l,(acc,element)->acc|(1l<