結果
問題 | No.2225 Treasure Searching Rod (Easy) |
ユーザー |
|
提出日時 | 2023-04-28 01:27:01 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 443 ms / 2,000 ms |
コード長 | 1,459 bytes |
コンパイル時間 | 14,254 ms |
コンパイル使用メモリ | 166,928 KB |
実行使用メモリ | 185,104 KB |
最終ジャッジ日時 | 2024-11-17 04:50:24 |
合計ジャッジ時間 | 20,872 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (98 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;using System.Collections.Generic;using System.Linq;class Program{static void Main(string[] args){var input = Console.ReadLine().Split().Select(int.Parse).ToArray();var H = input[0];var W = input[1];var K = (long)input[2];var sum = 0L;var treasure = new Dictionary<(int, int), long>();for (int i = 0; i < K; i++){var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();temp[0]--;temp[1]--;treasure.Add((temp[0], temp[1]), temp[2]);}var dic = new Dictionary<(int, int), int>();for (int i = 0; i < H; i++){for (int j = 0; j < W; j++){for (int x = i; x < H; x++){for (int y = j - (H - i) < 0 ? 0 : j - (H - i); y < (j + (H - i) > W - 1 ? W : j + (H - i)); y++){if ((x + y >= i + j) && (x - y >= i - j)){if (dic.ContainsKey((x, y))) dic[(x, y)]++;else dic.Add((x, y), 1);}}}}}foreach (var item in treasure){if (dic.ContainsKey(item.Key)) sum += dic[item.Key] * item.Value;}Console.WriteLine(sum % 998244353);}}