結果

問題 No.457 (^^*)
ユーザー 6soukiti296soukiti29
提出日時 2017-03-23 11:13:20
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 1,052 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 355,940 KB
最終ジャッジ日時 2023-09-19 08:46:32
合計ジャッジ時間 5,134 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,940 KB
testcase_01 AC 18 ms
7,972 KB
testcase_02 AC 17 ms
7,996 KB
testcase_03 AC 17 ms
8,012 KB
testcase_04 AC 18 ms
8,004 KB
testcase_05 AC 17 ms
8,148 KB
testcase_06 AC 17 ms
8,080 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
count_left = S.count("(")
count_right = S.count(")")
F = [[[0]*2 for i in range(count_right)] for j in range(count_left)]
kl = 0
flag = [[0,0],[0,0]]
for si,s in enumerate(S):
	if s == "(":
		flag.pop()
		flag.insert(0,[0,0])
		kr = 0
		countstar = 0
		countyama = 0
		countstya = 0
		Lface = 0
		Rface = 0
		for ti,t in enumerate(S[si + 1:]):
			if t == "(":
				flag[0][1] = 1
			if t == "*":
				countstar = countstar + 1
				if countyama >= 2:
					Lface = 1
			elif t == "^":
				countyama = countyama + 1
				if countstya == 1:
					Rface = 1
				elif countstar >= 1:
					countstya = 1
			if t == ")":
				if flag[0][1] == 0:
					flag[0][0] = flag[0][0] + 1
				F[kl][kr][0] = Lface
				F[kl][kr][1] = Rface
				
				if kl > 0 and kr > 0 and len(F[kl - 1]) > kr + flag[1][0] and F[kl][kr] == F[kl - 1][kr + flag[1][0]] == [1, 1]:
					F[kl] = F[kl][:kr] + F[kl - 1][kr + flag[1][0]:]
					break
				
				kr = kr + 1

		kl = kl + 1
sumL = 0
sumR = 0
for f in F:
	for g in f:
		sumL = sumL + g[0]
		sumR = sumR + g[1]
print(sumL,sumR)
0