結果

問題 No.457 (^^*)
ユーザー fiordfiord
提出日時 2017-03-01 06:34:39
言語 Python2
(2.7.18)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 794 bytes
コンパイル時間 1,168 ms
コンパイル使用メモリ 6,524 KB
実行使用メモリ 11,184 KB
最終ジャッジ日時 2023-09-02 21:01:29
合計ジャッジ時間 2,497 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
5,856 KB
testcase_01 AC 11 ms
5,996 KB
testcase_02 AC 11 ms
6,104 KB
testcase_03 AC 11 ms
5,908 KB
testcase_04 AC 11 ms
5,876 KB
testcase_05 AC 11 ms
5,856 KB
testcase_06 AC 11 ms
5,916 KB
testcase_07 AC 13 ms
6,096 KB
testcase_08 AC 16 ms
6,164 KB
testcase_09 AC 22 ms
6,644 KB
testcase_10 AC 39 ms
8,332 KB
testcase_11 AC 66 ms
11,184 KB
testcase_12 AC 62 ms
10,160 KB
testcase_13 AC 60 ms
9,340 KB
testcase_14 AC 62 ms
9,520 KB
testcase_15 AC 62 ms
10,240 KB
testcase_16 AC 60 ms
9,424 KB
testcase_17 AC 61 ms
9,368 KB
testcase_18 AC 11 ms
5,772 KB
testcase_19 AC 11 ms
5,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s=raw_input()
#(^^*)
left=[[0 for i in range(6)] for j in range(len(s))]
left[0][0]=1
right=[[0 for i in range(6)] for j in range(len(s))]
right[0][0]=1
for i in xrange(len(s)):
	if i==0:
		if s[0]=='(':
			left[0][1]=1
			right[0][1]=1
		continue
	for j in range(6):
		left[i][j]+=left[i-1][j]
		right[i][j]+=right[i-1][j]
	if s[i]=='(':
		left[i][1]+=left[i-1][0]
		right[i][1]+=right[i-1][0]
	elif s[i]=='^':
		left[i][2]+=left[i-1][1]-left[i-1][2]
		left[i][3]+=left[i-1][2]-left[i-1][3]
		right[i][3]+=right[i-1][2]-right[i-1][3]
		right[i][4]+=right[i-1][3]-right[i-1][4]
	elif s[i]=='*':
		left[i][4]+=left[i-1][3]-left[i-1][4]
		right[i][2]+=right[i-1][1]-right[i-1][2]
	elif s[i]==')':
		left[i][5]+=left[i-1][4]
		right[i][5]+=right[i-1][4]
print left[len(s)-1][5],right[len(s)-1][5]
0