結果

問題 No.1996 <><
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-05-14 01:29:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 1,133 bytes
コンパイル時間 4,075 ms
コンパイル使用メモリ 270,136 KB
実行使用メモリ 12,112 KB
最終ジャッジ日時 2023-08-19 20:35:36
合計ジャッジ時間 6,714 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,356 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 43 ms
7,632 KB
testcase_12 AC 173 ms
12,112 KB
testcase_13 AC 156 ms
12,068 KB
testcase_14 AC 138 ms
11,820 KB
testcase_15 AC 119 ms
10,496 KB
testcase_16 AC 85 ms
9,896 KB
testcase_17 AC 106 ms
10,512 KB
testcase_18 AC 43 ms
7,336 KB
testcase_19 AC 51 ms
8,144 KB
testcase_20 AC 60 ms
7,872 KB
testcase_21 AC 93 ms
9,720 KB
testcase_22 AC 111 ms
10,784 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 AC 43 ms
7,528 KB
testcase_25 AC 20 ms
5,732 KB
testcase_26 AC 34 ms
6,700 KB
testcase_27 AC 8 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 18 ms
5,224 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 8 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>
#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint1000000007;

template <typename T>
void compress(vector<T> &A){

    map<T, T> comp;
    int N = A.size(), i=0;
    for (int i=0; i<N; i++) comp[A[i]];

    for (auto &e : comp){
        e.second = i;
        i++;
    }

    for (int i=0; i<N; i++) A[i] = comp[A[i]];
}

int main(){

    ll N, K;
    string S;
    cin >> N >> K;
    vector<ll> A(N);
    for (int i=0; i<N; i++) cin >> A[i];
    cin >> S;
    compress(A);
    vector<fenwick_tree<mint>> dp(K+1, fenwick_tree<mint>(N));

    for (int i=0; i<N; i++){
        for (int j=1; j<=K; j++){
            if (S[j-1] == '<') dp[j].add(A[i], dp[j-1].sum(0, A[i]));
            else dp[j].add(A[i], dp[j-1].sum(A[i]+1, N));
        }
        dp[0].add(A[i], 1);
    }

    cout << dp[K].sum(0, N).val() << endl;

    return 0;
}
0