結果
問題 | No.457 (^^*) |
ユーザー | compass19 |
提出日時 | 2016-12-10 17:25:36 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 755 bytes |
コンパイル時間 | 342 ms |
コンパイル使用メモリ | 10,844 KB |
実行使用メモリ | 12,732 KB |
最終ジャッジ日時 | 2023-08-19 10:23:04 |
合計ジャッジ時間 | 7,205 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
12,092 KB |
testcase_01 | AC | 16 ms
7,960 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 16 ms
7,764 KB |
testcase_05 | AC | 16 ms
7,876 KB |
testcase_06 | AC | 16 ms
7,716 KB |
testcase_07 | AC | 17 ms
7,828 KB |
testcase_08 | AC | 23 ms
7,956 KB |
testcase_09 | AC | 28 ms
7,936 KB |
testcase_10 | AC | 82 ms
7,768 KB |
testcase_11 | AC | 278 ms
8,256 KB |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
ソースコード
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'))