Mafia | 프로그래밍의 벗 PivotOJ
PivotOJ

Mafia

시간 제한: 1000ms메모리 제한: 1024MB출처: Programmeringsolympiaden 2016 — katt2BOJ 21351

문제

A mafia has infiltrated the city <insert name here>. This has made the police force of <insert name here> very confused, with accusations of corruption being made in every direction. The city's NN cops (which are numbered between 00 and N1N - 1) has made a number of accusations about other policemen. Each accusation is either:

  1. Police number ii is an honest cop.
  2. Police number ii is a corrupt cop.

An honest cop always tells the truth, while a corrupt cop always lies. In total, there has been MM accusations.

The chief of police is now trying to fix the situation, starting with determining how many of her police men are corrupt. She has GG different guesses about the number of corrupt cops, and for each such number CC, she wants to know how many different sets of size CC can be corrupt (where all the remaining cops are honest), given that all accusations are consistent.

입력

The sample judge reads input in the following format:

  • line 11: N M
  • line 22: A[0] ... A[M - 1]
  • line 33: B[0] ... B[M - 1]
  • line 44: T[0] ... T[M - 1]
  • line 55: G: the number of calls made to guess(C).
  • line 66 C1 ... CG: the parameters of the GG calls to guess(C).

출력

The sample judge will write GG lines with the return values of guess(C).

예제

예제 1

입력
3 2
1 2
0 1
2 2
4
0 1 2 3
출력
0 1 1 0
코드를 제출하려면 로그인하세요.