結果

問題 No.1996 <><
ユーザー 沙耶花沙耶花
提出日時 2022-07-01 21:36:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 861 bytes
コンパイル時間 3,907 ms
コンパイル使用メモリ 269,400 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-05-04 15:51:19
合計ジャッジ時間 5,835 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 47 ms
7,808 KB
testcase_12 AC 159 ms
12,032 KB
testcase_13 AC 148 ms
12,416 KB
testcase_14 AC 145 ms
11,904 KB
testcase_15 AC 99 ms
10,624 KB
testcase_16 AC 72 ms
9,728 KB
testcase_17 AC 114 ms
10,752 KB
testcase_18 AC 41 ms
7,552 KB
testcase_19 AC 49 ms
8,448 KB
testcase_20 AC 58 ms
8,192 KB
testcase_21 AC 88 ms
9,856 KB
testcase_22 AC 107 ms
11,008 KB
testcase_23 AC 4 ms
6,940 KB
testcase_24 AC 43 ms
7,680 KB
testcase_25 AC 20 ms
6,940 KB
testcase_26 AC 35 ms
6,944 KB
testcase_27 AC 7 ms
6,944 KB
testcase_28 AC 1 ms
6,944 KB
testcase_29 AC 18 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 7 ms
6,944 KB
testcase_32 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

int main(){
	
	int N,K;
	cin>>N>>K;
	
	vector<int> a(N);
	rep(i,N){
		cin>>a[i];
	}
	vector<int> t = a;
	sort(t.begin(),t.end());
	t.erase(unique(t.begin(),t.end()),t.end());
	rep(i,N){
		a[i] = distance(t.begin(),lower_bound(t.begin(),t.end(),a[i]));
	}
	
	string S;
	cin>>S;
	
	vector<fenwick_tree<mint>> F(K+2,fenwick_tree<mint>(t.size()));
	
	rep(i,N){
		
		for(int j=1;j<=K+1;j++){
			if(j==1){
				F[j].add(a[i],1);
			}
			else{
				if(S[j-2]=='>'){
					F[j].add(a[i],F[j-1].sum(a[i]+1,t.size()));
				}
				else{
					F[j].add(a[i],F[j-1].sum(0,a[i]));
				}
				
			}
		}
	}
	cout<<F[K+1].sum(0,t.size()).val()<<endl;
	
    return 0;
}
0