atcoder#ABC282B. [ABC282B] Let's Get a Perfect Score
[ABC282B] Let's Get a Perfect Score
Score : points
Problem Statement
participants, numbered to , will participate in a contest with problems, numbered to .
For an integer between and and an integer between and , participant can solve problem if the -th character of is o
, and cannot solve it if that character is x
.
The participants must be in pairs. Print the number of ways to form a pair of participants who can collectively solve all the problems.
More formally, print the number of pairs of integers satisfying such that for any integer between and , at least one of participant and participant can solve problem .
Constraints
- is an integer between and , inclusive.
- is an integer between and , inclusive.
- is a string of length consisting of
o
andx
.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
5 5
ooooo
oooxx
xxooo
oxoxo
xxxxx
5
The following five pairs satisfy the condition: participants and , participants and , participants and , participants and , and participants and .
On the other hand, the pair of participants and , for instance, does not satisfy the condition because they cannot solve problem .
3 2
ox
xo
xx
1
2 4
xxxx
oxox
0