結果

問題 No.457 (^^*)
ユーザー ebicochinealebicochineal
提出日時 2016-12-09 01:52:34
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 670 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2023-08-19 02:59:48
合計ジャッジ時間 5,592 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,684 KB
testcase_01 AC 65 ms
71,320 KB
testcase_02 AC 66 ms
71,316 KB
testcase_03 AC 70 ms
71,392 KB
testcase_04 AC 62 ms
71,356 KB
testcase_05 AC 63 ms
71,456 KB
testcase_06 AC 62 ms
71,304 KB
testcase_07 AC 69 ms
76,000 KB
testcase_08 AC 74 ms
75,964 KB
testcase_09 AC 101 ms
76,352 KB
testcase_10 AC 424 ms
77,008 KB
testcase_11 TLE -
testcase_12 AC 67 ms
75,756 KB
testcase_13 AC 66 ms
75,708 KB
testcase_14 AC 66 ms
75,756 KB
testcase_15 AC 69 ms
75,892 KB
testcase_16 AC 67 ms
75,756 KB
testcase_17 AC 63 ms
75,736 KB
testcase_18 AC 63 ms
71,612 KB
testcase_19 AC 62 ms
71,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    S = input()
    l, r = [], []
    lc = rc = 0
    lcnt = rcnt = 0
    for i in range(len(S)):
        if S[i] == '(':
            lc += 1
        else:
            if lc > 0 : l += [(i, lc)]
            lc = 0
        if S[i] == ')' :
            rc += 1
        else:
            if rc > 0 : r += [(i-1, rc)]
            rc = 0
    if rc > 0 : r += [(len(S)-1, rc)]
    
    for s, n in l:
        for e, m in r:
            i = S.find('*', s, e)
            if i > -1:
                lcnt += (S.count('^', s, S.rfind('*', s, e)) > 1)*m*n
                rcnt += (S.count('^', i, e) > 1)*n*m
    print(lcnt, rcnt)

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