結果
| 問題 |
No.2924 <===Super Spaceship String===>
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-10-12 16:01:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 162 ms / 2,000 ms |
| コード長 | 500 bytes |
| コンパイル時間 | 321 ms |
| コンパイル使用メモリ | 82,456 KB |
| 実行使用メモリ | 113,432 KB |
| 最終ジャッジ日時 | 2024-10-16 17:55:14 |
| 合計ジャッジ時間 | 1,870 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
ソースコード
S = input()
st = []
for c in S:
match c:
case '<':
st.append((c, 1))
case '=':
if st and st[-1][0] == '=':
_, cnt = st.pop()
st.append((c, cnt+1))
else:
st.append((c, 1))
case '>':
if len(st) >= 2 and st[-2][0] == '<' and st[-1][0] == '=':
st.pop()
st.pop()
else:
st.append((c, 1))
print(sum(cnt for _, cnt in st))
norioc