結果
問題 | No.2924 <===Super Spaceship String===> |
ユーザー |
![]() |
提出日時 | 2024-10-12 15:08:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 323 ms / 2,000 ms |
コード長 | 492 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 251,152 KB |
最終ジャッジ日時 | 2024-10-16 17:54:02 |
合計ジャッジ時間 | 2,407 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
import collections S = list(input()) ans = len(S) deep = 0 D = collections.defaultdict(collections.deque) NG = collections.defaultdict(int) NG[0]=1 for s in S: if s == '<': deep+=1 D[deep] = collections.deque() D[deep].append(s) if s == '=': D[deep].append(s) if s == '>': if len(D[deep])<=1: NG[deep]=1 D[deep].append(s) if NG[deep]==0: ans-=len(D[deep]) deep-=1 print(ans)