結果

問題 No.2225 Treasure Searching Rod (Easy)
ユーザー 2bit2bit
提出日時 2023-02-25 10:45:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 1,581 bytes
コンパイル時間 2,177 ms
コンパイル使用メモリ 204,444 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-11 11:24:24
合計ジャッジ時間 3,894 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 14 ms
4,348 KB
testcase_08 AC 15 ms
4,352 KB
testcase_09 AC 14 ms
4,348 KB
testcase_10 AC 11 ms
4,352 KB
testcase_11 AC 11 ms
4,348 KB
testcase_12 AC 14 ms
4,352 KB
testcase_13 AC 15 ms
4,356 KB
testcase_14 AC 14 ms
4,352 KB
testcase_15 AC 11 ms
4,352 KB
testcase_16 AC 11 ms
4,352 KB
testcase_17 AC 11 ms
4,352 KB
testcase_18 AC 11 ms
4,352 KB
testcase_19 AC 11 ms
4,348 KB
testcase_20 AC 11 ms
4,352 KB
testcase_21 AC 5 ms
4,348 KB
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 4 ms
4,352 KB
testcase_24 AC 5 ms
4,352 KB
testcase_25 AC 3 ms
4,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define fix(x) fixed << setprecision(x)
#define eb emplace_back
constexpr char nl='\n';
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vs = vector<string>;
using pl = pair<long long, long long>;
template <typename T> inline bool chmin(T& a, const T& b) {bool compare = a > b; if (a > b) a = b; return compare;}
template <typename T> inline bool chmax(T& a, const T& b) {bool compare = a < b; if (a < b) a = b; return compare;}
template<class T>using rp_queue=priority_queue<T,vector<T>,greater<T>>;
void fast_io(){cin.tie(nullptr);ios_base::sync_with_stdio(false);}
template <typename T> T gcd(T a, T b) {if (b == 0)return a; else return gcd(b, a % b);}
template <typename T> inline T lcm(T a, T b) {return a /gcd(a, b)*b;}
const ll INF = 1LL << 60;
const ld PI = acos(-1);
const ll mod = 998244353;
void solve(){
  int H,W,K;cin>>H>>W>>K;
  vvl cnt(H,vl(W,-1));
  rep(i,K){
    int x,y;
    ll k;cin>>x>>y>>k;
    x--;
    y--;
    cnt[x][y] = k;
  }
  ll ans = 0;
  rep(x,H){
    rep(y,W){
      rep(i,H){
        rep(j,W){
          if(x+y>=i+j&&x-y>=i-j){
            if(cnt[x][y]!=-1){
              ans+=cnt[x][y];
              ans%=mod;
            }
          }
        }
      }
    }
  }
  cout<<ans<<endl;
}
int main(){
  fast_io();
  int num_tc = 1;
  //cin >> num_tc;
  rep(tc,num_tc){
    //cout << "Case #" << tc+1 << ": " ;// << endl;
    solve();
  }
}
0