結果

問題 No.457 (^^*)
ユーザー compass19compass19
提出日時 2016-12-10 17:20:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 594 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 14,980 KB
最終ジャッジ日時 2023-08-19 10:22:46
合計ジャッジ時間 4,422 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
14,980 KB
testcase_01 AC 13 ms
7,848 KB
testcase_02 AC 14 ms
7,756 KB
testcase_03 AC 14 ms
7,828 KB
testcase_04 AC 13 ms
7,792 KB
testcase_05 AC 13 ms
7,732 KB
testcase_06 AC 13 ms
7,904 KB
testcase_07 AC 13 ms
7,764 KB
testcase_08 AC 17 ms
7,752 KB
testcase_09 AC 23 ms
7,740 KB
testcase_10 AC 73 ms
7,724 KB
testcase_11 AC 255 ms
7,980 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
left_pos = [i for i, k in enumerate(s) if k == '(']
right_pos = [i for i, k in enumerate(s) if k == ')']

def solve(LorR):
	res = 0
	for i in left_pos:
		is_exist = False
		for j in right_pos:
			if j < i: continue
			if is_exist: res += 1; continue
			if LorR == 'left':   # 左向き
				tmp = s[i+1:j]
			else:                # 右向き
				tmp = s[i+1:j][::-1]
			count = 0
			for elm in tmp:
				if count < 2:
					if elm == '^':
						count += 1
				else:
					if elm == '*':
						res += 1
						is_exist = True
						break
	return res

print(solve('left'), solve('right'))
0