結果
| 問題 |
No.457 (^^*)
|
| コンテスト | |
| ユーザー |
compass19
|
| 提出日時 | 2016-12-10 21:59:15 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,135 bytes |
| コンパイル時間 | 202 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-29 02:09:23 |
| 合計ジャッジ時間 | 1,630 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 2 |
ソースコード
s = input()
left_pos = [i for i, k in enumerate(s) if k == '(']
def left_solve():
res = 0
is_first = None
tmp_stock = None
for i in left_pos:
tmp = s[i+1:]
if is_first is not None and i < is_first:
if tmp_stock is not None:
res += tmp_stock
continue
is_first = None
count = 0
for j, elm in enumerate(tmp):
if count < 2:
if elm == '^':
if is_first is None: is_first = j + i
count += 1
else:
if elm == '*':
ttmp = tmp[j+1:]
tmp_stock = ttmp.count(')')
res += tmp_stock
break
return res
def right_solve():
res = 0
is_first = None
tmp_stock = None
for i in left_pos:
tmp = s[i+1:]
if is_first is not None and i < is_first:
if tmp_stock is not None:
res += tmp_stock
continue
is_first = None
count = 0
for j, elm in enumerate(tmp):
if count < 1:
if elm == '*':
count += 1
if is_first is None: is_first = j + i
elif count < 2:
if elm == '^':
count += 1
else:
if elm == '^':
ttmp = tmp[j+1:]
tmp_stock = ttmp.count(')')
res += tmp_stock
break
return res
print(left_solve(), right_solve())
compass19