結果

問題 No.1709 Indistinguishable by MEX
ユーザー minimumminimum
提出日時 2023-05-21 17:40:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 108,708 KB
最終ジャッジ日時 2023-08-23 15:13:10
合計ジャッジ時間 5,411 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
70,848 KB
testcase_01 AC 66 ms
71,028 KB
testcase_02 AC 68 ms
70,600 KB
testcase_03 AC 68 ms
71,156 KB
testcase_04 AC 67 ms
70,720 KB
testcase_05 AC 68 ms
71,140 KB
testcase_06 AC 67 ms
70,728 KB
testcase_07 AC 66 ms
70,764 KB
testcase_08 AC 105 ms
101,160 KB
testcase_09 AC 98 ms
97,720 KB
testcase_10 AC 95 ms
95,468 KB
testcase_11 AC 91 ms
92,488 KB
testcase_12 AC 89 ms
90,568 KB
testcase_13 AC 104 ms
100,916 KB
testcase_14 AC 101 ms
98,084 KB
testcase_15 AC 103 ms
100,696 KB
testcase_16 AC 114 ms
108,492 KB
testcase_17 AC 110 ms
104,380 KB
testcase_18 AC 114 ms
108,348 KB
testcase_19 AC 112 ms
108,188 KB
testcase_20 AC 114 ms
108,348 KB
testcase_21 AC 117 ms
108,708 KB
testcase_22 AC 113 ms
108,476 KB
testcase_23 AC 113 ms
108,512 KB
testcase_24 AC 113 ms
108,596 KB
testcase_25 AC 115 ms
108,512 KB
testcase_26 AC 68 ms
70,936 KB
testcase_27 AC 93 ms
92,772 KB
testcase_28 AC 92 ms
90,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

N = int(input())
P = list(map(int, input().split()))
pos = [-1] * N
for i in range(N):
    pos[P[i]] = i

l, r = pos[0], pos[0]

ans = 1

for i in range(1, N):
    if l < pos[i] < r:
        ans *= (r - l + 1 - i)
        ans %= MOD
    else:
        l = min(l, pos[i])
        r = max(r, pos[i])

print(ans)
0