結果
問題 | No.2225 Treasure Searching Rod (Easy) |
ユーザー |
|
提出日時 | 2023-07-13 16:29:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 956 bytes |
コンパイル時間 | 968 ms |
コンパイル使用メモリ | 111,144 KB |
最終ジャッジ日時 | 2025-02-15 10:13:57 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include<iostream> #include<set> #include<algorithm> #include<vector> #include<string> #include<set> #include<map> #include<numeric> #include<queue> #include<cmath> #include <unordered_set> using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair<int,int> P; typedef pair<int,P> PP; const ll MOD=998244353; int main(){ int H,W,K; cin>>H>>W>>K; vector<vector<ll>> grid(H,vector<ll>(W,0)); vector<int> x(K),y(K); vector<ll> v(K); for(int k=0;k<K;k++){ cin>>x[k]>>y[k]>>v[k]; x[k]--;y[k]--; grid[x[k]][y[k]]=v[k]; } ll ans=0; for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ for(int x=0;x<H;x++){ for(int y=0;y<W;y++){ if((x+y)>=(i+j) && (x-y)>=(i-j)){ ans+=grid[x][y]; ans%=MOD; } } } } } cout<<ans<<endl; }