結果

問題 No.457 (^^*)
ユーザー htkbhtkb
提出日時 2018-05-25 09:49:14
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 474 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 12,768 KB
最終ジャッジ日時 2023-09-11 03:20:59
合計ジャッジ時間 7,096 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,104 KB
testcase_01 AC 17 ms
8,220 KB
testcase_02 AC 16 ms
8,112 KB
testcase_03 AC 16 ms
8,108 KB
testcase_04 AC 16 ms
8,116 KB
testcase_05 AC 17 ms
8,068 KB
testcase_06 AC 16 ms
8,108 KB
testcase_07 AC 20 ms
8,164 KB
testcase_08 AC 38 ms
8,092 KB
testcase_09 AC 84 ms
8,088 KB
testcase_10 AC 467 ms
8,116 KB
testcase_11 AC 1,847 ms
8,068 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
right, left = "* ^ ^".split()+[")"]*10000, "^ ^ *".split()+[")"]*10000
result_r, result_l = 0, 0
for i, c in enumerate(S):
    if c != "(":
        continue
    r_i, l_i = 0, 0
    r_c, l_c = right[0], left[0]
    for c2 in S[i+1:]:
        if c2 == r_c:
            r_i += 1
            r_c = right[r_i]
        if c2 == l_c:
            l_i += 1
            l_c = left[l_i]
    result_r += max(0, r_i-3)
    result_l += max(0, l_i-3)

print(result_l, result_r)
0