結果

問題 No.3709 Unknown Treasure
コンテスト
ユーザー 👑 loop0919
提出日時 2026-09-11 21:52:59
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 288 ms / 2,000 ms
+ 438µs
コード長 526 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 77 ms
コンパイル使用メモリ 80,512 KB
実行使用メモリ 115,584 KB
最終ジャッジ日時 2026-09-11 21:53:16
合計ジャッジ時間 7,251 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

H, W, N = [int(s) for s in input().split()]
imos = [[0] * (W + 1) for _ in range(H + 1)]

for _ in range(N):
    r1, c1, r2, c2 = [int(s) - 1 for s in input().split()]
    imos[r1][c1] += 1
    imos[r2 + 1][c1] -= 1
    imos[r1][c2 + 1] -= 1
    imos[r2 + 1][c2 + 1] += 1

for i in range(H):
    for j in range(W + 1):
        imos[i + 1][j] += imos[i][j]

for j in range(W):
    for i in range(H + 1):
        imos[i][j + 1] += imos[i][j]

not_exists = sum(sum(v >= 1 for v in row) for row in imos)
print(H * W - not_exists)
0