結果

問題 No.2229 Treasure Searching Rod (Hard)
ユーザー 👑 kakel-sankakel-san
提出日時 2023-11-09 22:06:03
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 334 ms / 2,000 ms
コード長 1,017 bytes
コンパイル時間 7,445 ms
コンパイル使用メモリ 157,196 KB
実行使用メモリ 193,796 KB
最終ジャッジ日時 2023-11-09 22:06:21
合計ジャッジ時間 18,365 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
32,548 KB
testcase_01 AC 80 ms
32,548 KB
testcase_02 AC 80 ms
32,548 KB
testcase_03 AC 80 ms
32,932 KB
testcase_04 AC 80 ms
32,548 KB
testcase_05 AC 80 ms
32,676 KB
testcase_06 AC 81 ms
32,548 KB
testcase_07 AC 282 ms
65,404 KB
testcase_08 AC 285 ms
65,364 KB
testcase_09 AC 284 ms
65,432 KB
testcase_10 AC 280 ms
65,404 KB
testcase_11 AC 279 ms
65,768 KB
testcase_12 AC 188 ms
61,172 KB
testcase_13 AC 187 ms
61,172 KB
testcase_14 AC 183 ms
61,356 KB
testcase_15 AC 334 ms
65,508 KB
testcase_16 AC 286 ms
65,508 KB
testcase_17 AC 285 ms
65,508 KB
testcase_18 AC 288 ms
65,380 KB
testcase_19 AC 295 ms
65,380 KB
testcase_20 AC 289 ms
65,380 KB
testcase_21 AC 288 ms
65,380 KB
testcase_22 AC 290 ms
65,380 KB
testcase_23 AC 177 ms
61,048 KB
testcase_24 AC 195 ms
61,300 KB
testcase_25 AC 203 ms
61,300 KB
testcase_26 AC 122 ms
47,396 KB
testcase_27 AC 96 ms
37,668 KB
testcase_28 AC 266 ms
65,516 KB
testcase_29 AC 259 ms
65,380 KB
testcase_30 AC 104 ms
39,844 KB
testcase_31 AC 119 ms
193,796 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (104 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    static long[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (h, w, k) = (c[0], c[1], c[2]);
        var map = NArr(k);
        var ans = 0L;
        var mod = 998_244_353;
        foreach (var tr in map)
        {
            var count = tr[0] * tr[0];
            var left = tr[1] - tr[0];
            var ltri = left < 1 ? ((1 - left) * (0 - left) / 2) : 0;
            var right = tr[1] + tr[0];
            var rtri = right > w ? ((right - w) * (right - w - 1) / 2) : 0;
            ans = (ans + (count - ltri - rtri) % mod * tr[2] % mod) % mod;
        }
        WriteLine(ans);
    }
}
0