結果
問題 | No.3021 Maximize eval |
ユーザー |
|
提出日時 | 2025-02-19 11:14:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 805 bytes |
コンパイル時間 | 869 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 213,192 KB |
最終ジャッジ日時 | 2025-02-19 11:14:22 |
合計ジャッジ時間 | 7,162 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 14 |
ソースコード
import itertoolst=int(input())for _ in range(t):s=list(input())RLE=[[key,len(list(group))] for key,group in itertools.groupby(s)]stc=[]for i in range(len(RLE)):if RLE[i][0]=="?":if i>0 and RLE[i-1][0]=="-":stc.append("1")if i<len(RLE)-1 and RLE[i+1][0] not in ["-","+"] and RLE[i][1]>1:stc.append("+")stc+=["9"]*(RLE[i][1]-2)else:if RLE[i][1]>2:stc.append("+")stc += ["9"] * (RLE[i][1] - 2)else:stc+=["1"]*(RLE[i][1]-1)else:stc+=["9"]*RLE[i][1]else:stc+=[RLE[i][0]]*RLE[i][1]print("".join(stc))