結果
問題 | No.2225 Treasure Searching Rod (Easy) |
ユーザー |
👑 ![]() |
提出日時 | 2022-12-06 18:53:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 642 bytes |
コンパイル時間 | 659 ms |
コンパイル使用メモリ | 74,188 KB |
最終ジャッジ日時 | 2025-02-09 05:49:57 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#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;}