結果

問題 No.1709 Indistinguishable by MEX
ユーザー chocoruskchocorusk
提出日時 2021-10-15 21:41:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 989 bytes
コンパイル時間 3,793 ms
コンパイル使用メモリ 188,996 KB
実行使用メモリ 5,204 KB
最終ジャッジ日時 2023-10-17 20:09:22
合計ジャッジ時間 5,605 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 52 ms
4,936 KB
testcase_09 AC 42 ms
4,704 KB
testcase_10 AC 40 ms
4,652 KB
testcase_11 AC 32 ms
4,472 KB
testcase_12 AC 31 ms
4,448 KB
testcase_13 AC 47 ms
4,832 KB
testcase_14 AC 43 ms
4,736 KB
testcase_15 AC 46 ms
4,800 KB
testcase_16 AC 60 ms
5,152 KB
testcase_17 AC 55 ms
5,036 KB
testcase_18 AC 66 ms
5,204 KB
testcase_19 AC 66 ms
5,204 KB
testcase_20 AC 65 ms
5,204 KB
testcase_21 AC 62 ms
5,204 KB
testcase_22 AC 63 ms
5,204 KB
testcase_23 AC 62 ms
5,204 KB
testcase_24 AC 62 ms
5,204 KB
testcase_25 AC 62 ms
5,204 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 33 ms
4,520 KB
testcase_28 AC 30 ms
4,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
using mint=modint998244353;

int main()
{
    int n; cin>>n;
    int p[200020], ind[200020];
    for(int i=0; i<n; i++){
        cin>>p[i];
        ind[p[i]]=i;
    }
    int l=n, r=-1;
    mint ans=1;
    for(int i=0; i<n; i++){
        if(l<=ind[i] && ind[i]<=r)ans*=(r-l+1-i);
        l=min(l, ind[i]);
        r=max(r, ind[i]);
        
    }
    cout<<ans.val()<<endl;
    return 0;
}
0