結果
問題 |
No.1709 Indistinguishable by MEX
|
ユーザー |
|
提出日時 | 2022-01-07 20:52:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 532 ms / 2,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 315 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 41,748 KB |
最終ジャッジ日時 | 2024-11-14 08:16:20 |
合計ジャッジ時間 | 10,219 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
n = int(input()) a = list(map(int, input().split())) mod = 998244353 place = {} for i in range(n): place[a[i]] = i ans = 1 l = place[0] r = place[0] for i in range(1, n): l_nxt = min(l, place[i]) r_nxt = max(r, place[i]) if l == l_nxt and r == r_nxt: ans *= r - l + 1 - i ans %= mod l = l_nxt r = r_nxt print(ans)