結果
問題 |
No.1709 Indistinguishable by MEX
|
ユーザー |
![]() |
提出日時 | 2022-05-28 16:57:24 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 303 bytes |
コンパイル時間 | 188 ms |
コンパイル使用メモリ | 82,532 KB |
実行使用メモリ | 107,520 KB |
最終ジャッジ日時 | 2024-09-20 23:14:22 |
合計ジャッジ時間 | 3,414 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
n=int(input()) p=list(map(int,input().split())) idx=[0]*n for i in range(n): idx[p[i]]=i mod=998244353 ans=1 L,R=idx[0],idx[0] size=0 for i in idx[1:]: if L<i<R: ans*=size ans%=mod size-=1 else: if i<L: size+=L-i-1 L=i else: size+=i-R-1 R=i print(ans)