結果

問題 No.2225 Treasure Searching Rod (Easy)
ユーザー cotoracotora
提出日時 2023-03-03 20:16:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 805 ms
コンパイル使用メモリ 72,536 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-17 22:12:55
合計ジャッジ時間 1,959 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;

int main(void){
    int h,w,k;
    cin>>h>>w>>k;
    vector<vector<long long int>> g(h,vector<long long int>(w,0));
    for(int i=0;i<k;i++){
        int x,y;
        long long int v;
        cin>>x>>y>>v;
        x--;y--;
        g[x][y]=v;
    }
    long long int 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+=g[x][y];
                    ans%=998244353;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
0