結果
問題 |
No.2924 <===Super Spaceship String===>
|
ユーザー |
|
提出日時 | 2025-10-17 11:19:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 141 ms / 2,000 ms |
コード長 | 366 bytes |
コンパイル時間 | 362 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 113,624 KB |
最終ジャッジ日時 | 2025-10-17 11:19:37 |
合計ジャッジ時間 | 2,165 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
S = input() stack = [] for c in S: if len(stack) >= 2 and stack[-2][0] == '<' and stack[-1][0] == '=' and c == '>': stack.pop() _, cnt = stack.pop() else: if stack and stack[-1][0] == c == '=': stack[-1] = (c, stack[-1][1] + 1) else: stack.append((c, 1)) ans = sum(cnt for _, cnt in stack) print(ans)