TouchStone
  Please Login
Login Sign Up
 Homepage  Problem Set  Examinations  Submissions  Discussions  Statistics
  • Home
  • Problem Set
  • P2011
  • Problem
  • P2011【CQOI2008】位统计
    Limits : Time Limit : 10000 MS   Memory Limit : 65536 KB
    Judgment Tips : 0.3s
    Description

    给出N个[0, 65535]的整数,编程支持以下操作:   
    修改操作:C d,所有数增加d。如果超过65535,把结果模65536。0 <= d <= 65535   
    查询操作:Q i,统计有多少整数的第i位非0,换句话说,有多少个整数与2i的“按位与”操作值为正。0 <= i <= 15   
    输出所有查询操作的统计值。 

    Input Format

    第一行为两个正整数N和M,即整数的个数和操作的个数,第二行包含N个[0,65535]的整数。以下M行为各操作,格式如题所述。

    Output Format

    输出M个数,即所有Q操作的统计值。

    Sample Input

    3 5
    1 2 4
    Q 1
    Q 2
    C 1
    Q 1
    Q 2

    Sample Output

    1
    1
    2
    1

    Hint