Big Number Array
Practice
4 (9 votes)
Advanced data structures
Data structures
Easy
Fenwick tree
Segment trees
Problem
89% Success 3218 Attempts 30 Points 1s Time Limit 64MB Memory 1024 KB Max Code

Given an array of n integers. Initially, all elements are zero. You are asked to complete q queries of two kinds:

1 x y l r: for each i in range [x, y] flip the l-th bit to r-bit of i-th element.

2 x y: check if x-th element equals y-th element.

Input Format

The first line contains an integer T denoting the number of test cases. Each test case is described as follow:

A line contains two space-separated integers n, q denoting the size of array and the number of queries. q queries follow are described as in the statement.

Output Format

For each query of kind 2, output a single line contains "YES" if two numbers are equal, otherwise "NO".

Constraints

  • 1 ≤ T ≤ 100
  • 1 ≤ n ≤ 105
  • 1 ≤ q ≤ 105
  • 1 ≤ sum of n over all test cases ≤ 2.105
  • 1 ≤ sum of q over all test cases ≤ 2.105
  • 1 ≤ xyn
  • 0 ≤ lr ≤ 109

 

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
8 votes
Tags:
Bit ManipulationEasyFenwick TreeSegment TreesSieve
Points:30
35 votes
Tags:
Advanced Data StructuresData StructuresSegment Trees