結果
問題 | No.2225 Treasure Searching Rod (Easy) |
ユーザー |
![]() |
提出日時 | 2023-05-05 00:18:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 872 bytes |
コンパイル時間 | 1,059 ms |
コンパイル使用メモリ | 109,676 KB |
最終ジャッジ日時 | 2025-02-12 17:02:42 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <iostream>#include <vector>#include <cmath>#include <map>#include <set>#include <iomanip>#include <queue>#include <algorithm>#include <numeric>#include <deque>#include <complex>#include <cassert>using namespace std;using ll = long long;const ll modc = 998244353;int main(){ll H, W, K, ans=0, x, y, w;cin >> H >> W >> K;vector<vector<ll>> c(H+1, vector<ll>(W+1));for (int i=0; i<K; i++){cin >> x >> y >> w;c[x][y] = w;}for (int i=1; i<=H; i++){for (int j=1; j<=W; j++){for (int x=1; x<=H; x++){for (int y=1; y<=W; y++){if (x+y>=i+j && x-y>=i-j){ans += c[x][y];ans %= modc;}}}}}cout << ans << endl;return 0;}