結果

問題 No.2225 Treasure Searching Rod (Easy)
ユーザー m21139m21139
提出日時 2023-02-24 22:03:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 2,016 bytes
コンパイル時間 2,082 ms
コンパイル使用メモリ 204,520 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-11 06:15:59
合計ジャッジ時間 3,597 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
#define all(x) (x).begin(), (x).end()
#define rep1(a)          for(int i = 0; i < a; i++)
#define rep2(i, a)       for(int i = 0; i < a; i++)
#define rep3(i, a, b)    for(int i = a; i < b; i++)
#define rep4(i, a, b, c) for(int i = a; i < b; i += c)
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define fore(i, a) for (auto &i : a)
#define rfore(a) for(auto i=a.rbegin(), e=a.rend(); i!=e; ++i)
#define enld endl
#define fix(n) cout << fixed << setprecision(n);
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>using rp_queue=priority_queue<T,vector<T>,greater<T>>;
void fast_io(){cin.tie(nullptr);ios_base::sync_with_stdio(false);}
typedef long long ll;
typedef unsigned long long ull;
const int inf = INT_MAX / 2;
const ll infl = 1LL<<60;
const ll mod = 1000000007;
const int dx[8] = {0, 1, 0,-1, 1, 1,-1,-1};
const int dy[8] = {1, 0,-1, 0, 1,-1, 1,-1};

int main() {
    fast_io();
    const ll mymod = 998244353;
    int H,W,K; cin >> H >> W >> K;
    vector<vector<ll>>value(H,vector<ll>(W,0));
    rep(K) {
        ll x,y,v; cin >> x >> y >> v;
        x--, y--; value[x][y] = 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 += value[x][y]; ans%=mymod;
        }
    }

    cout << ans << endl;
}
0