Submission #11669697


Source Code Expand

Copy
n, m = gets.split.map(&:to_i)

ss = m.times.with_object([]) do |_, arr|
  _, *s = gets.split.map(&:to_i)
  arr.push(s)
end
ps = gets.split.map(&:to_i)

ans = 0

(1 << n).times do |bit|
  valid = true

  m.times do |i|
    count = ss[i].count { |s| bit[s - 1] == 1 }

    if count % 2 != ps[i]
      valid = false
      break
    end
  end

  ans += 1 if valid
end

puts ans

Submission Info

Submission Time
Task C - Switches
User cheezenaan
Language Ruby (2.3.3)
Score 300
Code Size 400 Byte
Status
Exec Time 12 ms
Memory 1788 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 300 / 300 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 8 ms 1788 KB
02.txt 8 ms 1788 KB
03.txt 8 ms 1788 KB
04.txt 9 ms 1788 KB
05.txt 9 ms 1788 KB
06.txt 8 ms 1788 KB
07.txt 9 ms 1788 KB
08.txt 8 ms 1788 KB
09.txt 9 ms 1788 KB
10.txt 9 ms 1788 KB
11.txt 8 ms 1788 KB
12.txt 9 ms 1788 KB
13.txt 8 ms 1788 KB
14.txt 8 ms 1788 KB
15.txt 12 ms 1788 KB
16.txt 8 ms 1788 KB
17.txt 8 ms 1788 KB
18.txt 8 ms 1788 KB
19.txt 8 ms 1788 KB
20.txt 8 ms 1788 KB
21.txt 8 ms 1788 KB
22.txt 8 ms 1788 KB
23.txt 8 ms 1788 KB
24.txt 8 ms 1788 KB
25.txt 8 ms 1788 KB
26.txt 8 ms 1788 KB
27.txt 12 ms 1788 KB
s1.txt 7 ms 1788 KB
s2.txt 7 ms 1788 KB
s3.txt 7 ms 1788 KB