結果

問題 No.457 (^^*)
ユーザー ebicochinealebicochineal
提出日時 2016-12-09 00:41:08
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 640 bytes
コンパイル時間 1,357 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 82,752 KB
最終ジャッジ日時 2023-08-19 02:40:45
合計ジャッジ時間 5,342 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
75,672 KB
testcase_01 AC 61 ms
71,200 KB
testcase_02 AC 59 ms
71,268 KB
testcase_03 AC 60 ms
71,324 KB
testcase_04 AC 61 ms
71,268 KB
testcase_05 AC 62 ms
71,256 KB
testcase_06 AC 67 ms
75,688 KB
testcase_07 AC 91 ms
77,036 KB
testcase_08 AC 154 ms
77,040 KB
testcase_09 AC 556 ms
76,952 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    def f(s, e, lcnt, rcnt):
        l1 = l2 = r1 = r2 = 0
        for i in S[s:e]:
            if i == '*':
                r1 = 1
                if l2>1 : l1 = 1
            elif i == '^':
                if r1 : r2 += 1
                l2 += 1
        if l1 : lcnt += 1
        if r2 > 1 : rcnt += 1
        return lcnt, rcnt
    
    S = input()
    l, r = [], []
    lcnt = rcnt = 0
    for i in range(len(S)):
        if S[i] == '(' : l += [i+1]
        if S[i] == ')' : r += [i]
    for s in l:
        for e in r:
            lcnt, rcnt = f(s, e, lcnt, rcnt)
    print(lcnt, rcnt)

if __name__ == '__main__':
    main()
0