結果

問題 No.1996 <><
ユーザー 沙耶花沙耶花
提出日時 2022-07-01 21:36:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 861 bytes
コンパイル時間 4,072 ms
コンパイル使用メモリ 268,024 KB
実行使用メモリ 12,196 KB
最終ジャッジ日時 2023-08-17 09:00:16
合計ジャッジ時間 6,687 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 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,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 51 ms
7,700 KB
testcase_12 AC 165 ms
12,080 KB
testcase_13 AC 150 ms
12,196 KB
testcase_14 AC 144 ms
11,552 KB
testcase_15 AC 104 ms
10,548 KB
testcase_16 AC 75 ms
9,452 KB
testcase_17 AC 121 ms
10,520 KB
testcase_18 AC 45 ms
7,332 KB
testcase_19 AC 55 ms
8,132 KB
testcase_20 AC 62 ms
8,152 KB
testcase_21 AC 96 ms
9,468 KB
testcase_22 AC 115 ms
10,848 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 AC 47 ms
7,328 KB
testcase_25 AC 23 ms
5,640 KB
testcase_26 AC 39 ms
6,560 KB
testcase_27 AC 8 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 20 ms
5,432 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 8 ms
4,376 KB
testcase_32 AC 2 ms
4,384 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