#573. 「Nowcoder多校 2019 Day2」Subarray
「Nowcoder多校 2019 Day2」Subarray
当前没有测试数据。
题目描述
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
输出格式
Output one line containing an integer representing the answer.
样例
样例输入 1
1
0 1
样例输出 1
4
样例输入 2
1
1 2
样例输出 2
5
样例输入 3
2
0 1
3 4
样例输出 3
16
数据范围与提示
for