結果

問題 No.2433 Min Increasing Sequence
ユーザー 👑 kakel-sankakel-san
提出日時 2023-08-18 23:32:52
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 977 bytes
コンパイル時間 2,236 ms
コンパイル使用メモリ 63,668 KB
実行使用メモリ 47,528 KB
最終ジャッジ日時 2023-08-18 23:33:27
合計ジャッジ時間 9,264 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
23,600 KB
testcase_01 AC 58 ms
19,512 KB
testcase_02 AC 60 ms
21,592 KB
testcase_03 AC 60 ms
21,524 KB
testcase_04 AC 157 ms
47,528 KB
testcase_05 AC 107 ms
31,164 KB
testcase_06 AC 135 ms
39,704 KB
testcase_07 AC 116 ms
35,932 KB
testcase_08 AC 146 ms
40,836 KB
testcase_09 AC 131 ms
40,368 KB
testcase_10 AC 94 ms
29,788 KB
testcase_11 AC 119 ms
37,708 KB
testcase_12 AC 92 ms
26,808 KB
testcase_13 AC 86 ms
24,596 KB
testcase_14 AC 125 ms
37,244 KB
testcase_15 AC 87 ms
24,564 KB
testcase_16 AC 96 ms
29,028 KB
testcase_17 AC 88 ms
26,632 KB
testcase_18 AC 148 ms
41,020 KB
testcase_19 AC 148 ms
41,176 KB
testcase_20 AC 75 ms
24,464 KB
testcase_21 AC 138 ms
41,772 KB
testcase_22 AC 142 ms
38,996 KB
testcase_23 AC 135 ms
39,704 KB
testcase_24 AC 160 ms
47,008 KB
testcase_25 AC 141 ms
42,284 KB
testcase_26 AC 126 ms
40,188 KB
testcase_27 AC 139 ms
41,776 KB
testcase_28 AC 135 ms
40,892 KB
testcase_29 AC 82 ms
23,032 KB
testcase_30 AC 109 ms
24,872 KB
testcase_31 AC 76 ms
23,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        var ismin = new bool[n];
        ismin[n - 1] = true;
        var min = a[n - 1];
        for (var i = n - 2; i >= 0; --i)
        {
            if (a[i] <= min)
            {
                min = a[i];
                ismin[i] = true;
            }
        }
        var prev = -1;
        var ans = 1L;
        var mod = 998_244_353;
        for (var i = 0; i < n; ++i) if (ismin[i])
        {
            if (prev >= 0)
            {
                ans = ans * (i - prev + 1) % mod;
            }
            prev = i;
        }
        WriteLine(ans);
    }
}
0