#P3822. [NOI2017] 整数

    ID: 2779 远端评测题 2000ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>高精度2017线段树NOI 系列O2优化进制

[NOI2017] 整数

Description

Dr. P abstracts his computation task as operations on an integer.

Specifically, there is an integer xx, initially 00.

Then there are nn operations, each of the following two types:

  • 1 a b: add the integer a2ba \cdot 2^b to xx, where aa is an integer and bb is a nonnegative integer.
  • 2 k: ask for the value of the bit of xx in binary whose weight is 2k2^k (that is, a 11 in this bit represents 2k2^k).

It is guaranteed that x0x \geqslant 0 at all times.

Input Format

The first line of input contains four positive integers n,t1,t2,t3n, t_1, t_2, t_3. The meaning of nn is given in the problem statement, and the meanings of t1,t2,t3t_1, t_2, t_3 are given in the subtasks.

Then follow nn lines, each giving one operation. The specific format and meaning are as described above.

Output Format

For each query operation, output one line representing the answer (00 or 11). For addition operations, there is no output.

10 3 1 2
1 100 0
1 2333 0
1 -233 0
2 5
2 7
2 15
1 5 15
2 15
1 -1 12
2 15
0
1
0
1
0

Hint

In all test points, 1t131 \leqslant t_1 \leqslant 3, 1t241 \leqslant t_2 \leqslant 4, 1t321 \leqslant t_3 \leqslant 2. Different pairs t1,t2,t3t_1, t_2, t_3 correspond to the following special restrictions:

  • For t1=1t_1 = 1, a=1a = 1.
  • For t1=2t_1 = 2, a=1|a| = 1.
  • For t1=3t_1 = 3, a109|a| \leqslant 10^9.
  • For t2=1t_2 = 1, 0b,k300 \leqslant b, k \leqslant 30.
  • For t2=2t_2 = 2, 0b,k1000 \leqslant b, k \leqslant 100.
  • For t2=3t_2 = 3, 0b,kn0 \leqslant b, k \leqslant n.
  • For t2=4t_2 = 4, 0b,k30n0 \leqslant b, k \leqslant 30n.
  • For t3=1t_3 = 1, all query operations appear after all addition operations.
  • For t3=2t_3 = 2, the order between query operations and addition operations is not guaranteed.

There are 25 test points in total, each worth 4 points. The Constraints of each test point are as follows:

::cute-table{tuack}

Test point ID nn \le t1t_1 t2t_2 t3t_3
11 1010 33 11 22
22 100100 22
33 20002000
44 40004000 11 33
55 60006000 33 11
66 80008000 22 22
77 90009000 33 44
88 1000010000 33
99 3000030000 44
1010 5000050000 11
1111 6000060000 33 22
1212 6500065000 22 44
1313 7000070000 33
1414 200000200000
1515 300000300000 22
1616 400000400000 33
1717 500000500000 33
1818 600000600000 44
1919 700000700000
2020 800000800000 11
2121 900000900000 22
2222 930000930000 33 33
2323 960000960000 44 11
2424 990000990000 33 22
2525 10000001000000 44

Translated by ChatGPT 5