結果
問題 |
No.2924 <===Super Spaceship String===>
|
ユーザー |
![]() |
提出日時 | 2024-10-12 15:20:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 159 ms / 2,000 ms |
コード長 | 1,265 bytes |
コンパイル時間 | 258 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 111,732 KB |
最終ジャッジ日時 | 2024-10-16 17:54:19 |
合計ジャッジ時間 | 2,269 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
# oj t -c "python3 main.py" import sys,math from collections import defaultdict,deque from itertools import combinations,permutations,accumulate,product from bisect import bisect_left,bisect_right from heapq import heappop,heappush,heapify #from more_itertools import distinct_permutations,distinct_combinations #from sortedcontainers import SortedList,SortedSet def input():return sys.stdin.readline().rstrip() def ii(): return int(input()) def ms(): return map(int, input().split()) def li(): return list(map(int,input().split())) inf = pow(10,18) mod = 998244353 #///////////////////////////////// S = input() que = deque() cnt = 0 for s in S: #print(que,s,len(que)) if s=="<": cnt += 1 que.append(s) elif s==">": if cnt==0 or que[-1]=="<": que.append(s) else: remove = deque() while que: n = que.pop() remove.append(n) if n=="<": cnt -= 1 break if n==">": while remove: n = remove.pop() que.append(n) que.append(s) break else: que.append(s) print(len(que))