結果
| 問題 | No.2433 Min Increasing Sequence | 
| コンテスト | |
| ユーザー |  tnakao0123 | 
| 提出日時 | 2023-08-23 09:49:57 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 33 ms / 2,000 ms | 
| コード長 | 782 bytes | 
| コンパイル時間 | 632 ms | 
| コンパイル使用メモリ | 41,600 KB | 
| 実行使用メモリ | 6,144 KB | 
| 最終ジャッジ日時 | 2024-12-21 11:43:31 | 
| 合計ジャッジ時間 | 3,899 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 32 | 
ソースコード
/* -*- coding: utf-8 -*-
 *
 * 2433.cc:  No.2433 Min Increasing Sequence - yukicoder
 */
#include<cstdio>
#include<algorithm>
 
using namespace std;
/* constant */
const int MAX_N = 200000;
const int MOD = 998244353;
const int INF = 1 << 30;
/* typedef */
/* global variables */
int as[MAX_N + 1], ls[MAX_N + 1], dp[MAX_N + 1], ss[MAX_N + 1];
/* subroutines */
inline void addmod(int &a, int b) { a = (a + b) % MOD; }
/* main */
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i);
  as[n] = INF;
  ls[n] = n;
  dp[n] = ss[n] = 1;
  for (int i = n - 1; i >= 0; i--) {
    ls[i] = (as[i] <= as[ls[i + 1]]) ? i : ls[i + 1];
    dp[i] = ss[ls[i] + 1];
    ss[i] = (dp[i] + ss[i + 1]) % MOD;
  }
  printf("%d\n", dp[0]);
  return 0;
}
            
            
            
        