結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー 👑 kakel-sankakel-san
提出日時 2024-03-03 21:15:55
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 438 ms / 2,000 ms
コード長 1,174 bytes
コンパイル時間 15,339 ms
コンパイル使用メモリ 158,380 KB
実行使用メモリ 179,428 KB
最終ジャッジ日時 2024-03-03 21:16:33
合計ジャッジ時間 37,557 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
32,420 KB
testcase_01 AC 78 ms
32,420 KB
testcase_02 AC 79 ms
32,420 KB
testcase_03 AC 79 ms
32,420 KB
testcase_04 AC 79 ms
32,420 KB
testcase_05 AC 80 ms
32,420 KB
testcase_06 AC 80 ms
32,420 KB
testcase_07 AC 77 ms
32,420 KB
testcase_08 AC 78 ms
32,420 KB
testcase_09 AC 77 ms
32,420 KB
testcase_10 AC 79 ms
32,420 KB
testcase_11 AC 78 ms
32,420 KB
testcase_12 AC 79 ms
32,420 KB
testcase_13 AC 197 ms
60,520 KB
testcase_14 AC 368 ms
65,548 KB
testcase_15 AC 213 ms
60,776 KB
testcase_16 AC 219 ms
60,776 KB
testcase_17 AC 193 ms
60,392 KB
testcase_18 AC 299 ms
64,008 KB
testcase_19 AC 282 ms
64,004 KB
testcase_20 AC 303 ms
64,008 KB
testcase_21 AC 87 ms
34,852 KB
testcase_22 AC 297 ms
64,008 KB
testcase_23 AC 267 ms
64,132 KB
testcase_24 AC 110 ms
42,788 KB
testcase_25 AC 370 ms
65,416 KB
testcase_26 AC 384 ms
69,388 KB
testcase_27 AC 213 ms
60,776 KB
testcase_28 AC 383 ms
69,640 KB
testcase_29 AC 381 ms
69,508 KB
testcase_30 AC 415 ms
69,508 KB
testcase_31 AC 388 ms
69,508 KB
testcase_32 AC 363 ms
69,508 KB
testcase_33 AC 415 ms
69,636 KB
testcase_34 AC 382 ms
69,636 KB
testcase_35 AC 389 ms
69,508 KB
testcase_36 AC 438 ms
69,508 KB
testcase_37 AC 398 ms
69,508 KB
testcase_38 AC 373 ms
69,508 KB
testcase_39 AC 401 ms
69,636 KB
testcase_40 AC 386 ms
69,636 KB
testcase_41 AC 396 ms
69,508 KB
testcase_42 AC 409 ms
69,508 KB
testcase_43 AC 353 ms
65,844 KB
testcase_44 AC 354 ms
65,840 KB
testcase_45 AC 396 ms
65,840 KB
testcase_46 AC 367 ms
65,968 KB
testcase_47 AC 363 ms
65,840 KB
testcase_48 AC 422 ms
69,616 KB
testcase_49 AC 387 ms
69,620 KB
testcase_50 AC 79 ms
32,420 KB
testcase_51 AC 79 ms
32,548 KB
testcase_52 AC 80 ms
179,428 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (94 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 n = NN;
        var map = NArr(n);

        var tall = 0L;
        for (var i = 0; i < n; ++i) tall = (tall + map[i][0]) % mod;
        var left = 0L;
        var sum = 0L;
        var ans = 0L;
        for (var i = 0; i < n; ++i)
        {
            sum = (sum + map[i][0]) % mod;
            var cur = (Calc(tall, sum) - left + mod) % mod;
            left = (left + cur) % mod;
            ans = (ans + cur * map[i][1] % mod) % mod;
        }
        WriteLine(ans);
    }
    static int mod = 998_244_353;
    static int rev24 = 291_154_603;
    static long Calc(long t, long x)
    {
        return rev24 * x % mod * (x + 1) % mod * (x + 2) % mod * ((4 * t - 3 * x + 3 + mod) % mod) % mod;
    }
}
0