結果

問題 No.2924 <===Super Spaceship String===>
ユーザー ryuusagi
提出日時 2024-10-12 16:00:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 825 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 101,040 KB
最終ジャッジ日時 2024-10-12 16:00:28
合計ジャッジ時間 1,706 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()

t = []
q = []

S = 0
ans = 0
for c in s:
    if c == '<':
        if S:
            q.append((t, S))
        t = ['<']
        S = 1
    elif c == '=':
        if S == 1 or S == 2:
            S = 2
            t.append('=')
        else:
            ans += 1
            S = 0
            if t:
                ans += len(t)
                t = []
            for l, _ in q:
                ans += len(l)
                q = []
    else:
        if S == 2:
            if q:
                t, S = q.pop()
            else:
                t, S = [], 0
        else:
            ans += 1
            S = 0
            if t:
                ans += len(t)
                t = []
            for l, _ in q:
                ans += len(l)
                q = []
ans += len(t)
for l in q:
    ans += len(l)
print(ans)
0