結果

問題 No.1709 Indistinguishable by MEX
ユーザー untiunti
提出日時 2021-05-28 00:06:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 11,816 KB
実行使用メモリ 31,976 KB
最終ジャッジ日時 2023-10-17 19:43:52
合計ジャッジ時間 5,940 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,028 KB
testcase_01 AC 29 ms
10,028 KB
testcase_02 AC 29 ms
10,028 KB
testcase_03 AC 29 ms
10,028 KB
testcase_04 AC 29 ms
10,028 KB
testcase_05 AC 29 ms
10,028 KB
testcase_06 AC 29 ms
10,028 KB
testcase_07 AC 29 ms
10,028 KB
testcase_08 AC 229 ms
28,896 KB
testcase_09 AC 198 ms
25,468 KB
testcase_10 AC 191 ms
25,464 KB
testcase_11 AC 158 ms
22,756 KB
testcase_12 AC 153 ms
21,900 KB
testcase_13 AC 208 ms
27,492 KB
testcase_14 AC 188 ms
25,824 KB
testcase_15 AC 197 ms
26,852 KB
testcase_16 AC 254 ms
31,976 KB
testcase_17 AC 233 ms
31,520 KB
testcase_18 AC 283 ms
31,772 KB
testcase_19 AC 286 ms
31,772 KB
testcase_20 AC 286 ms
31,772 KB
testcase_21 AC 264 ms
31,772 KB
testcase_22 AC 265 ms
31,772 KB
testcase_23 AC 192 ms
31,772 KB
testcase_24 AC 190 ms
31,772 KB
testcase_25 AC 186 ms
31,772 KB
testcase_26 AC 29 ms
10,028 KB
testcase_27 AC 121 ms
22,824 KB
testcase_28 AC 106 ms
21,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353 
n=int(input()) 
a = list(map(int, input().split())) 
place = [0 for i in range(n)]
for i in range(n) :
  place[a[i]] = i 
left = place[0] 
right = place[0]  
ans=1 
for i in range(n-1) :
  if place[i+1] < left :
    left = place[i+1] 
  elif place[i+1] > right :
    right = place[i+1] 
  else :
    ans=ans*(right-left-i) 
    ans%=mod

print(ans) 
0