• [I] Internet of Lights and Switches

  • 时间限制: 5000 ms 内存限制: 65535 K
  • 问题描述
  • You are a fan of "Internet of Things"(IoT, 物联网), so you build a nice Internet of Lights and Switches in your huge mansion. Formally, there are n lights and m switches, each switch controls one or more lights, i.e. pressing that switch flips the status of those lights (on->off, off->on).


    Initially, all the lights are on. Your task is to count the number of ways to turn off all the lights by pressing some consecutive switches. Each switch should not be pressed more than once. There is only one restriction: the number of switches you pressed should be between a and b (inclusive).





  • 输入
  • There will be at most 20 test cases. Each test case begins with a line containing four integers n, m, a, b (2<=n<=50, 1<=a<=b<=m<=300000). Each of the following m lines contains a 01 string of length n. The i-th character is 1 if and only if that switch controls the i-th light. The size of the whole input file does not exceed 8MB.
  • 输出
  • For each test case, print the case number, and the number of ways to turn off all the lights.
  • 样例输入
  • 2 4 1 4
    01
    
10
    
11
    
00 
    2 4 3 3
    01 
    10
    
11
    
00
    6 3 1 3
    101001
    010110
    101001 
  • 样例输出
  • Case 1: 3
    Case 2: 0
    Case 3: 2
  • 提示
  • 来源
  • 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛
  • 操作

显示春菜