結果

問題 No.2225 Treasure Searching Rod (Easy)
ユーザー 唐揚げが壊わ唐揚げが壊わ
提出日時 2023-02-25 02:07:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 959 bytes
コンパイル時間 2,395 ms
コンパイル使用メモリ 202,852 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-11 07:50:17
合計ジャッジ時間 3,816 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 1 ms
4,368 KB
testcase_03 AC 1 ms
4,368 KB
testcase_04 AC 1 ms
4,368 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 20 ms
4,372 KB
testcase_08 AC 20 ms
4,368 KB
testcase_09 AC 19 ms
4,368 KB
testcase_10 AC 2 ms
4,368 KB
testcase_11 AC 1 ms
4,368 KB
testcase_12 AC 20 ms
4,372 KB
testcase_13 AC 19 ms
4,372 KB
testcase_14 AC 19 ms
4,368 KB
testcase_15 AC 2 ms
4,372 KB
testcase_16 AC 1 ms
4,368 KB
testcase_17 AC 1 ms
4,372 KB
testcase_18 AC 2 ms
4,372 KB
testcase_19 AC 1 ms
4,372 KB
testcase_20 AC 2 ms
4,372 KB
testcase_21 AC 6 ms
4,372 KB
testcase_22 AC 1 ms
4,368 KB
testcase_23 AC 5 ms
4,372 KB
testcase_24 AC 2 ms
4,372 KB
testcase_25 AC 3 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
#define lln \
  ll n;     \
  cin >> n;
#define REP(i, n) for (long long i = 0; i < n; i++)
#define REPIN(v, n) \
  for (long long i = 0; i < n; i++) cin >> v[i];
ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main() {
  ll H, W, K;
  cin >> H >> W >> K;
  vvll xyv(K, {0, 0, 0});
  REP(i, K) { cin >> xyv[i][0] >> xyv[i][1] >> xyv[i][2]; }
  ll mod = 998244353, cnt = 0;
  REP(i, H) {
    REP(j, W) {
      REP(k, K) {
        if ((i + 1) + (j + 1) <= xyv[k][0] + xyv[k][1] &&
            (i + 1) - (j + 1) <= xyv[k][0] - xyv[k][1]) {
          cnt += xyv[k][2];
          cnt %= mod;
        }
      }
    }
  }
  cout << cnt % mod << endl;
}
0