結果

問題 No.2225 Treasure Searching Rod (Easy)
ユーザー a01sa01to
提出日時 2024-12-18 00:21:31
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 3,315 ms
コンパイル使用メモリ 250,560 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-18 00:21:36
合計ジャッジ時間 3,947 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector Grid(h, vector<ll>(w, 0));
  rep(_, k) {
    int x, y, v;
    cin >> x >> y >> v;
    Grid[x - 1][y - 1] = v;
  }
  ll ans = 0;
  rep(i, h) rep(j, w) {
    rep(x, h) rep(y, w) {
      if (x + y >= i + j && x - y >= i - j) ans += Grid[x][y];
    }
  }
  cout << ans % 998244353 << endl;
  return 0;
}
0