結果
問題 | No.1996 <>< |
ユーザー | Shirotsume |
提出日時 | 2022-05-05 03:01:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 925 bytes |
コンパイル時間 | 469 ms |
コンパイル使用メモリ | 87,152 KB |
実行使用メモリ | 98,788 KB |
最終ジャッジ日時 | 2023-08-17 07:57:53 |
合計ジャッジ時間 | 4,873 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
78,576 KB |
testcase_01 | AC | 67 ms
71,416 KB |
testcase_02 | AC | 69 ms
71,340 KB |
testcase_03 | AC | 74 ms
76,232 KB |
testcase_04 | AC | 75 ms
71,084 KB |
testcase_05 | AC | 68 ms
71,516 KB |
testcase_06 | AC | 70 ms
71,232 KB |
testcase_07 | AC | 70 ms
71,544 KB |
testcase_08 | AC | 86 ms
76,604 KB |
testcase_09 | AC | 77 ms
76,304 KB |
testcase_10 | AC | 85 ms
76,484 KB |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
import sys input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) INF = 2 ** 63 - 1 mod = 10 ** 9 + 7 n, k = mi() a = li() s = input() upgraph = [[] for _ in range(n)] downgraph = [[] for _ in range(n)] for i in range(n): for j in range(i + 1, n): if a[i] < a[j]: upgraph[i].append(j) elif a[i] > a[j]: downgraph[i].append(j) dp = [[0] * (k + 1) for _ in range(n + 1)] for i in range(n): dp[i][0] = 1 for i in range(n): for j in range(k): if s[j] == '<': for to in upgraph[i]: dp[to][j + 1] += dp[i][j] dp[to][j + 1] %= mod elif s[j] == '>': for to in downgraph[i]: dp[to][j + 1] += dp[i][j] dp[to][j + 1] %= mod ans = 0 for i in range(n): ans += dp[i][k] ans %= mod print(ans)