結果
問題 | No.2225 Treasure Searching Rod (Easy) |
ユーザー |
![]() |
提出日時 | 2023-02-24 21:28:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 941 bytes |
コンパイル時間 | 4,453 ms |
コンパイル使用メモリ | 252,608 KB |
最終ジャッジ日時 | 2025-02-10 20:29:52 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;using namespace std;using ll=long long;using ld=double;ld pie=3.14159265359;ll mod=998244353;ll inf=100000;int main(){ll h,w,k;cin >> h >> w >> k;vector<ll>x(k),y(k),v(k);vector<vector<ll>>g(h,vector<ll>(w,0));for (ll i = 0; i < k; i++){cin >> x[i] >> y[i] >> v[i];x[i]--,y[i]--;g[x[i]][y[i]]=v[i];}ll ans=0;for (ll i = 0; i < h; i++){for (ll j = 0; j < w; j++){for (ll kk = 0; kk < h; kk++){for (ll l = 0; l < w; l++){if (i+j<=kk+l&&i-j<=kk-l){ans+=g[kk][l];ans%=mod;}}}}}cout << ans <<endl;}