結果

問題 No.2229 Treasure Searching Rod (Hard)
ユーザー AngrySadEightAngrySadEight
提出日時 2022-12-07 11:51:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 642 bytes
コンパイル時間 722 ms
コンパイル使用メモリ 76,900 KB
実行使用メモリ 12,032 KB
最終ジャッジ日時 2024-04-21 20:43:42
合計ジャッジ時間 5,294 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

ll mod = 998244353;

int main(){
    int H,W,K;
    cin >> H >> W >> K;
    vector<int> x(K);
    vector<int> y(K);
    vector<ll> v(K);
    for (int i = 0; i < K; i++){
        cin >> x[i] >> y[i] >> v[i];
        x[i]--;
        y[i]--;
    }
    ll ans = 0;

    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            for (int k = 0; k < K; k++){
                if (x[k] + y[k] >= i + j && x[k] - y[k] >= i - j){
                    ans = (ans + v[k]) % mod;
                }
            }
        }
    }
    cout << ans << endl;
}
0