結果

問題 No.457 (^^*)
ユーザー compass19compass19
提出日時 2016-12-10 17:25:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 755 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 17,948 KB
最終ジャッジ日時 2024-05-06 17:34:27
合計ジャッジ時間 7,348 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
17,572 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 29 ms
10,624 KB
testcase_06 AC 29 ms
10,624 KB
testcase_07 AC 30 ms
10,624 KB
testcase_08 AC 33 ms
10,752 KB
testcase_09 AC 42 ms
10,624 KB
testcase_10 AC 107 ms
10,752 KB
testcase_11 AC 323 ms
10,752 KB
testcase_12 TLE -
testcase_13 TLE -
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
	is_first = None
	for i in left_pos:
		if is_first is not None and i < is_first: res += 1; continue
		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
			is_first = None
			for index, elm in enumerate(tmp):
				if count < 2:
					if elm == '^':
						if is_first is None: is_first = index
						count += 1
				else:
					if elm == '*':
						res += 1
						is_exist = True
						break
	return res

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