結果

問題 No.457 (^^*)
ユーザー ebicochineal
提出日時 2016-12-09 01:52:34
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 670 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 118,912 KB
最終ジャッジ日時 2024-11-28 16:06:08
合計ジャッジ時間 5,605 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

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