Programming contests

DEIK Regionális Programozó Csapatverseny, középiskolai kategória, 2022. december 4.

December 4, 2022, 10:00 AM – December 4, 2022, 3:15 PM

blackboards

There are N blackboards - T1 ... TN - with some integers written on them. We can perform repeatedly the following operations: select a blackboard, then select a pair of integers of the same parity, erase them and wite their sum or difference on the blackboard. For each blackboard, determine whether it is possible to have a single number on it.

Input Specification

The first line is an integer 1 ≤ N ≤ 100: the number of blackboards, then N lines follow, each with a description of a blackboard. The first integer 1 ≤ h ≤ 1000 tells us how many numbers the actual blackboard have, then h comma separated positive integers follow, each of which not larger than 106.

Output Specification

A single line with a length N string, whose k-th character is 1 if for the k-th blackboard we can reach the "single number" state or 0 otherwise.

Sample Input 1

  1. 4
  2. 3 1 2 3
  3. 4 2 2 2 2
  4. 1 1
  5. 4 2 2 2 1   
download as text file

Sample Output 1

  1. 1110
download as text file

Sample Input 2

  1. 2
  2. 1 3
  3. 1 2
download as text file

Sample Output 2

  1. 11
download as text file
University of Debrecen; Faculty of Informatics; v. 09/30/2024