| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 512 MB | 33 | 14 | 14 | 56.000% |
You are given a complete undirected graph on $n$ vertices, each edge is colored blue or yellow. Anton likes a subgraph on 4ドル$ vertices if, among its 6ドル$ edges, 5ドル$ edges have one color, and the 6ドル$-th edge has another color. Yahor likes a subgraph on 4ドル$ vertices if 3ドル$ of its edges are yellow, 3ドル$ are blue, and no 3ドル$ vertices form a triangle with edges of the same color.
On the image below, on the left, you can see examples of graphs Anton likes. On the right, there are examples of graphs Yahor likes.
Let $A$ be the number of subgraphs Anton likes, and $Y$ be the number of subgraphs Yahor likes. They want to know who likes more subgraphs. To help them, find the value $Y - A$.
The first line of the input contains a single integer $n$ (4ドル \le n \le 2000$), the number of vertices in the graph.
The $i$-th of the next $i$ lines contains a string $s_i$ of length $n$.
It is guaranteed that:
-'Y' or 'B', where' Y' shows that the edge between vertices $i$ and $j$ is yellow, and 'B' shows that it is blueOutput a single integer: the value $Y - A$.
5 -YBYB Y-BBB BB-BY YBB-Y BBYY-
2
6 -YYYYY Y-YYBB YY-YYY YYY-YB YBYY-Y YBYBY-
-6