結果
問題 | No.755 Zero-Sum Rectangle |
ユーザー |
![]() |
提出日時 | 2018-12-08 20:28:34 |
言語 | Nim (2.2.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 786 bytes |
コンパイル時間 | 3,388 ms |
コンパイル使用メモリ | 66,556 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-07-01 05:47:53 |
合計ジャッジ時間 | 25,862 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 TLE * 4 |
ソースコード
import strutils, sequtilsproc main() =letnm = stdin.readLine.split.map(parseInt)(n, m) = (nm[0], nm[1])a = (0..<m).mapIt(stdin.readLine.split.map(parseInt))var acc = newSeqWith(m+1, newSeq[int64](m+1))for i in 0..<m:acc[i+1][1] = a[i][0]for j in 1..<m:acc[i+1][j+1] = acc[i+1][j]+a[i][j]for j in 0..<m:for i in 1..<m:acc[i+1][j+1]+=acc[i][j+1]for _ in 0..<n:letyx = stdin.readLine.split.map(parseInt)(y, x) = (yx[0], yx[1])var tot = 0for sy in 1..m:for sx in 1..m:for gy in sy..m:for gx in sx..m:if sy<=y and y<=gy and sx<=x and x<=gx:if acc[gy][gx]-acc[gy][sx-1]-acc[sy-1][gx]+acc[sy-1][sx-1]==0:tot+=1echo totmain()