Boring Not boring problem
Practice
1 (2 votes)
Advanced data structures
Segment trees
Linear algebra
Data structures
Problem
87% Success 519 Attempts 50 Points 2s Time Limit 512MB Memory 1024 KB Max Code

You are given two integers $$n$$($$1 \le n \le 10^5$$) and $$m$$ ($$1 \le m \le 10^5$$). Initially, you have an array $$a$$ of $$n$$ zeros, and $$m$$ applied queries on it. Query is given as $$l$$ $$r$$ $$x$$, where you apply $$a_i$$ = $$a_i$$ xor $$x$$ (xor  denotes the operation bitwise XOR) for every $$i$$ between $$l$$ and $$r$$. But this problem seems boring, so Almas modify some queries interval. By modifying, he applied that operation on a subset of positions on a segment(maybe empty subset). Now he asks you how many different arrays he could have after applying queries. Since the answer can be large, output by modulo 1000000007 ($$10^9 + 7$$).

Input

- In first line, you are given two integers $$n$$ and $$m$$. 

- In next $$m$$ lines, you are given $$l$$ $$r$$ $$x$$. 

 

Output
-Print in a single line answer by modulo 1000000007.
 

Constraints

- $$1 \leq n \leq 10^5$$

- $$0 \leq m \leq 10^5$$

- $$1 \leq  l \leq  r \leq n$$

- $$0 \leq x \le 2^{30} - 1$$
 

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:50
3 votes
Tags:
Inclusion-exclusionData StructuresSegment TreesAdvanced Data StructuresBasic ProgrammingNumber theoryCombinatoricsMath
Points:50
4 votes
Tags:
Bit ManipulationSegment TreesAdvanced Data StructuresData Structures
Points:50
26 votes
Tags:
Data StructuresHardOpenSegment TreesTrees