結果
問題 | No.2225 Treasure Searching Rod (Easy) |
ユーザー |
![]() |
提出日時 | 2023-02-24 21:30:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 607 bytes |
コンパイル時間 | 2,228 ms |
コンパイル使用メモリ | 194,480 KB |
最終ジャッジ日時 | 2025-02-10 20:32:55 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define INF 1234567890 #define ll long long #define MOD 998244353 int N, M, K; int A[55][55]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin.exceptions(ios::badbit | ios::failbit); cin >> N >> M >> K; for(int i=0; i<K; i++) { int y, x, val; cin >> y >> x >> val; A[y][x] = val; } ll res = 0; for(int i=1; i<=N; i++) for(int j=1; j<=M; j++) for(int y=1; y<=N; y++) for(int x=1; x<=M; x++) if (y+x >= i+j && y-x >= i-j) res += A[y][x], res %= MOD; res %= MOD; res += MOD; res %= MOD; cout << res << "\n"; return 0; }