結果

問題 No.1996 <><
ユーザー MasKoaTSMasKoaTS
提出日時 2022-05-25 21:08:46
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 937 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 33,876 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-04 14:48:39
合計ジャッジ時間 11,162 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 0 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1,580 ms
5,376 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 1,489 ms
5,376 KB
testcase_19 AC 1,975 ms
5,376 KB
testcase_20 AC 1,652 ms
5,376 KB
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 21 ms
5,376 KB
testcase_24 AC 1,171 ms
5,376 KB
testcase_25 AC 391 ms
5,376 KB
testcase_26 AC 1,015 ms
5,376 KB
testcase_27 AC 107 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 423 ms
5,376 KB
testcase_30 AC 7 ms
5,376 KB
testcase_31 AC 97 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//愚直解(爆速)

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <stdio.h>
#include <stdlib.h>
#define u32 unsigned int
#define mod 1000000007
#define MAX_DATA 1500

int main(void) {
	int i, j, k;
	int N, K;	scanf("%d", &N);	scanf("%d", &K);
	int a[MAX_DATA] = { 0 };
	for (i = 0; i < N; ++i) {
		scanf("%d", a + i);
	}
	char s[MAX_DATA];
	scanf("%s", s);

	u32 dp[MAX_DATA] = { 0 };
	u32 ndp[MAX_DATA] = { 0 };
	for (i = 0; i < N; ++i) {
		dp[i] = 1;
	}
	for (i = 0; i < K; ++i) {
		int t = (s[i] == '<') ? 1 : -1;
		for (j = 0; j < N; ++j) {
			ndp[j] = 0;
			for (k = 0; k < j; ++k) {
				ndp[j] += (u32)((a[k] - a[j]) * t < 0) * dp[k];
				if (ndp[j] >= mod)
					ndp[j] %= mod;
			}
		}
		for (j = 0; j < N; ++j) {
			dp[j] = ndp[j];
		}
	}

	u32 ans = 0;
	for (i = 0; i < N; ++i) {
		ans += dp[i];
		if (ans >= mod)
			ans %= mod;
	}
	printf("%u\n", ans);

	return 0;
}
0