結果
問題 |
No.2924 <===Super Spaceship String===>
|
ユーザー |
![]() |
提出日時 | 2024-10-12 14:46:25 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 183 ms / 2,000 ms |
コード長 | 648 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 126,916 KB |
最終ジャッジ日時 | 2024-10-16 17:53:14 |
合計ジャッジ時間 | 1,841 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
def Run_Length(lst): run_length=[] if lst: prev=lst[0] cnt=1 for x in lst[1:]: if x==prev: cnt+=1 else: run_length.append((prev,cnt)) prev=x cnt=1 run_length.append((prev,cnt)) return run_length S=input() queue=[] for s in S: if queue and queue[-1][0]=="=" and s=="=": queue[-1][1]+=1 else: queue.append([s,1]) if len(queue)>=3 and (queue[-3][0],queue[-2][0],queue[-1][0])==("<","=",">"): queue.pop() queue.pop() queue.pop() ans=sum(c for s,c in queue) print(ans)