結果
問題 |
No.1996 <><
|
ユーザー |
![]() |
提出日時 | 2022-05-04 20:48:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 714 bytes |
コンパイル時間 | 4,169 ms |
コンパイル使用メモリ | 251,552 KB |
最終ジャッジ日時 | 2025-01-29 02:22:52 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 TLE * 14 |
ソースコード
//TLE(?) #include <bits/stdc++.h> #include <atcoder/all> #define rep(i, l, n) for (int i = (l); i < (n); i++) using namespace std; using namespace atcoder; using ll = long long; template <class T> using V = vector<T>; const ll mod = 1000000007; int main(void) { int N, K; cin >> N >> K; V<ll> a(N), b(N); rep(i, 0, N) { cin >> a[i]; } string s; cin >> s; V<ll> dp(N, 1); rep(i, 0, K) { V<ll> ndp(N); ll t = 1; if (s[i] == '>') { t = -1; } rep(j, 0, N) { rep(k, 0, j) { ndp[j] += ((a[k] - a[j]) * t < 0) * dp[k]; ndp[j] %= mod; } } rep(j, 0, N) { dp[j] = ndp[j]; } } ll ans = 0; for (ll t : dp) { ans += t; ans %= mod; } cout << ans << endl; return 0; }