結果
問題 |
No.2225 Treasure Searching Rod (Easy)
|
ユーザー |
![]() |
提出日時 | 2023-09-24 17:47:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 2,055 ms |
コンパイル使用メモリ | 192,536 KB |
最終ジャッジ日時 | 2025-02-17 02:10:27 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> #include<iostream> #include<map> #include<vector> #include <algorithm> #include<math.h> #include <iomanip> #include<set> #include <numeric> #include<string> using ll = long long; using namespace std; int main() { ll h, w, k, sum1 = 0, mod = 998244353; cin >> h >> w >> k; for (ll i = 0; i < k; i++){ ll x, y, v, dl, dr; cin >> x >> y >> v; dl = max(x - y, (ll) 0); dr = max(x - (w - y + 1), (ll) 0); sum1 += (x*x - (dl+1)*dl/2 - (dr+1)*dr/2)*v; sum1 %= mod; } cout << sum1 << endl; }