結果
| 問題 | No.3709 Unknown Treasure |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-21 18:17:20 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 228 ms / 2,000 ms |
| + 80µs | |
| コード長 | 938 bytes |
| 記録 | |
| コンパイル時間 | 62 ms |
| コンパイル使用メモリ | 81,120 KB |
| 実行使用メモリ | 141,260 KB |
| 最終ジャッジ日時 | 2026-09-21 18:17:29 |
| 合計ジャッジ時間 | 7,468 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
# https://yukicoder.me/problems/no/3709
def main():
H, W, N = map(int, input().split())
rects = []
for _ in range(N):
r1, c1, r2, c2 = map(int , input().split())
rects.append((r1 - 1, c1 -1, r2 - 1, c2 - 1))
cum_arrays = [[0] * (W + 1 ) for _ in range(H + 1)]
for r1, c1, r2, c2 in rects:
cum_arrays[r1][c1] += 1
cum_arrays[r1][c2 + 1] -= 1
cum_arrays[r2 + 1][c1] -= 1
cum_arrays[r2 + 1][c2 + 1] += 1
for h in range(H + 1):
c = 0
for w in range(W + 1):
c += cum_arrays[h][w]
cum_arrays[h][w] = c
for w in range(W + 1):
c = 0
for h in range(H + 1):
c += cum_arrays[h][w]
cum_arrays[h][w] = c
ans = 0
for h in range(H):
for w in range(W):
if cum_arrays[h][w] == 0:
ans += 1
print(ans)
if __name__ == "__main__":
main()