結果

問題 No.3709 Unknown Treasure
コンテスト
ユーザー 👑 cologne
提出日時 2026-09-15 13:17:20
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 1,317 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 76 ms
コンパイル使用メモリ 81,536 KB
実行使用メモリ 118,144 KB
最終ジャッジ日時 2026-09-15 13:17:27
合計ジャッジ時間 6,412 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 RE * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import collections
import heapq
import sys
from collections import defaultdict
from itertools import count, accumulate, pairwise, groupby

sys.setrecursionlimit(10 ** 6)
from typing import List, Tuple

int1 = lambda x: int(x) - 1
input = lambda: sys.stdin.readline().rstrip('\n')
ii = lambda: int(input())
vi = lambda: list(map(int, input().split()))
vi1 = lambda: list(map(int1, input().split()))


def dbg(*args, **kwargs):
    print(*(repr(arg) for arg in args), *(f'{k}: {repr(v)}' for k, v in kwargs.items()),
          sep='; ', file=sys.stderr, flush=True)


def main():
    h, w, n = vi()
    a = [[0] * (h + 1) for _ in range(w + 1)]
    for _ in range(n):
        r1, c1, r2, c2 = vi()
        a[r2][c2] += 1
        a[r1 - 1][c2] -= 1
        a[r2][c1 - 1] -= 1
        a[r1 - 1][c1 - 1] += 1
    for i in range(h + 1):
        for j in range(w + 1):
            if i > 0:
                a[i][j] += a[i - 1][j]
            if j > 0:
                a[i][j] += a[i][j - 1]
            if i > 0 and j > 0:
                a[i][j] -= a[i - 1][j - 1]

    # print(a)

    return sum(sum(y == 0 for y in x[:-1]) for x in a[:-1])


def _start():
    if (ret := main()) is not None:
        print(*ret) if isinstance(ret, List) or isinstance(ret, Tuple) else print(ret)


if __name__ == '__main__':
    _start()
0