結果

問題 No.2225 Treasure Searching Rod (Easy)
ユーザー ygd.ygd.
提出日時 2023-02-24 21:26:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 537 ms / 2,000 ms
コード長 1,018 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 79,288 KB
最終ジャッジ日時 2023-10-11 05:48:08
合計ジャッジ時間 7,356 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
72,744 KB
testcase_01 AC 110 ms
72,916 KB
testcase_02 AC 114 ms
72,288 KB
testcase_03 AC 112 ms
72,768 KB
testcase_04 AC 110 ms
72,384 KB
testcase_05 AC 112 ms
72,576 KB
testcase_06 AC 114 ms
72,636 KB
testcase_07 AC 534 ms
79,068 KB
testcase_08 AC 535 ms
79,288 KB
testcase_09 AC 535 ms
79,100 KB
testcase_10 AC 132 ms
78,116 KB
testcase_11 AC 118 ms
77,520 KB
testcase_12 AC 537 ms
79,052 KB
testcase_13 AC 536 ms
79,104 KB
testcase_14 AC 533 ms
79,044 KB
testcase_15 AC 126 ms
77,656 KB
testcase_16 AC 125 ms
77,624 KB
testcase_17 AC 126 ms
77,768 KB
testcase_18 AC 123 ms
77,528 KB
testcase_19 AC 124 ms
77,748 KB
testcase_20 AC 128 ms
77,492 KB
testcase_21 AC 208 ms
77,956 KB
testcase_22 AC 116 ms
72,692 KB
testcase_23 AC 196 ms
78,188 KB
testcase_24 AC 143 ms
78,316 KB
testcase_25 AC 148 ms
78,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline #文字列はダメ
#sys.setrecursionlimit(1000000)
import math
import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
from collections import defaultdict
from collections import deque
import copy #DeepCopy: hoge = [_[:] for _ in hogehoge]
#from functools import lru_cache
#@lru_cache(maxsize=None)
#MOD = pow(10,9) + 7
MOD = 998244353
dx = [1,0,-1,0]
dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]

def main():
    H,W,K = map(int,input().split())
    X = []; Y = []; V = []
    for _ in range(K):
        x,y,v = map(int,input().split())
        x -= 1; y -= 1
        X.append(x)
        Y.append(y)
        V.append(v)
    ans = 0
    for i in range(H):
        for j in range(W):
            for x,y,v in zip(X,Y,V):
                if x+y >= i+j and x-y >= i-j:
                    ans += v
                    ans %= MOD
    print(ans)

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