CF435D.Special Grid

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The first line contains two integers nn and mm (2<=n,m<=400)(2<=n,m<=400) . Each of the following nn lines contain mm characters (zeros and ones) — the description of the grid. If the jj -th character in the ii -th line equals zero, then the node on the ii -th horizontal line and on the jj -th vertical line is painted white. Otherwise, the node is painted black.

The horizontal lines are numbered starting from one from top to bottom, the vertical lines are numbered starting from one from left to right.

输入格式

Print a single integer — the number of required triangles.

输出格式

The figure below shows red and blue triangles. They are the examples of the required triangles in the first sample. One of the invalid triangles is painted green. It is invalid because not all sides go along the grid lines.

输入输出样例

  • 输入#1

    3 5
    10000
    10010
    00001
    

    输出#1

    20
    
  • 输入#2

    2 2
    00
    00
    

    输出#2

    4
    
  • 输入#3

    2 2
    11
    11
    

    输出#3

    0
    

说明/提示

The figure below shows red and blue triangles. They are the examples of the required triangles in the first sample. One of the invalid triangles is painted green. It is invalid because not all sides go along the grid lines.

首页