report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Good subarray - MarisaOJ: Marisa Online Judge

Good subarray

Time limit: 1000 ms
Memory limit: 512 MB
An array $B$ is good if $B$ only consists of consecutive integers when sorted. Given an array $A$ of $n$ integers. Count the number of good subarray in $A$. ### Input - The first line contains an integer $n$. - The next line contains $n$ integers $A_i$. ### Output - Print the number of good subarrays. ### Constraints - $1 \le n \le 10^5$. - $1 \le A_i \le n$. ### Example Input: ``` 3 1 2 3 ``` Output: ``` 6 ```
Divide and conquer
Product
Big board
Segment queries
xor xor xor
Coins flip
Slimes
4D longest path
Good subarray
Shortest path on grid
Dynamic MST
Topic
Hashing
Divide and conquer
Rating 2300
Solution (1) Solution