时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒 空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M 64bit IO Format: %lld
题目描述
Given an array A of length containing only 1 and -1. The number of 1 is not more than . Please count how many pairs of (l, r) satisfy and .
输入描述:
The first line of input contains an integers N indicating how many segments of A is 1. Following N lines each contains two space-separated integers indicating that is 1 for
for
输出描述:
Output one line containing an integer representing the answer.