結果
問題 | No.2225 Treasure Searching Rod (Easy) |
ユーザー |
|
提出日時 | 2023-02-24 21:36:19 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 1,135 bytes |
コンパイル時間 | 12,965 ms |
コンパイル使用メモリ | 393,872 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 05:11:12 |
合計ジャッジ時間 | 13,600 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
fn main() {let (h, w, k) = {let mut line = String::new();std::io::stdin().read_line(&mut line).unwrap();let mut iter = line.split_whitespace();(iter.next().unwrap().parse::<usize>().unwrap(),iter.next().unwrap().parse::<usize>().unwrap(),iter.next().unwrap().parse::<usize>().unwrap(),)};let mut xyv = Vec::new();for _ in 0..k {xyv.push({let mut line = String::new();std::io::stdin().read_line(&mut line).unwrap();let mut iter = line.split_whitespace();(iter.next().unwrap().parse::<usize>().unwrap() - 1,iter.next().unwrap().parse::<usize>().unwrap() - 1,iter.next().unwrap().parse::<usize>().unwrap(),)});}let mut ans = 0;for i in 0..h {for j in 0..w {for &(x, y, v) in &xyv {if x + y >= i + j && x + j >= i + y {ans = (ans + v) % 998244353;}}}}println!("{}", ans);}