Logo
(追記) (追記ここまで)

23122번 - Glory Graph 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB33141456.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:

  • For every $i$ from 1ドル$ to $n,ドル the $i$-th character of $s_i$ is '-'
  • For every $i \neq j,ドル the $j$-th character of $s_i$ is either 'Y' or 'B', where' Y' shows that the edge between vertices $i$ and $j$ is yellow, and 'B' shows that it is blue
  • For every $i \neq j,ドル the $j$-th character of $s_i$ is equal to the $i$-th character of $s_j$

출력

Output a single integer: the value $Y - A$.

제한

예제 입력 1

5
-YBYB
Y-BBB
BB-BY
YBB-Y
BBYY-

예제 출력 1

2

예제 입력 2

6
-YYYYY
Y-YYBB
YY-YYY
YYY-YB
YBYY-Y
YBYBY-

예제 출력 2

-6

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2021 > Day 3: IQ test by kefaa2, antontrygubO_o, and gepardo G번

Contest > Open Cup > 2021/2022 Season > Stage 2: Grand Prix of IMO G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /