report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Statement - FlandreOJ: Flandre Online Judge

Statement

Time limit: 1000 ms
Memory limit: 256 MB
There are $q$ statement, each of the form $(l, r, t)$ means that $$A_l + A_{l + 1} + ... + A_r$$ is odd if $t = 1$, or is even if $t = 0$. Find the largest $k$ that there is at least one array $A$ of length $n$ satisfies every statement from $1$ to $k$. ### Input - The first line contains 2 integers $n, q$. - The next $q$ lines, each line contains 3 integers $l, r, t$, a statement. ### Output - Print the a single integer is the largest possible $k$. ### Constraints - $1 \le n \le 10^5$. - $1 \le l, r \le n$. - $0 \le t \le 1$. ### Example Input: ``` 10 5 1 2 0 3 4 1 5 6 0 1 6 0 7 10 1 ``` Output: ``` 3 ```
Disjoint Set Union (DSU)
DSU
Component sum
Minimum spanning tree
Parking
Remove edge
Yet another problem
Assignment query on tree
Watering
Minimum spanning tree 2
Fatal meal
Statement
All pairs
Query on tree
Minimum spanning tree 3
Topic
DSU
Rating 1700
Solution (1) Solution