結果
| 問題 | No.930 数列圧縮 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-18 01:12:10 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 431 bytes |
| 記録 | |
| コンパイル時間 | 558 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 101,248 KB |
| 最終ジャッジ日時 | 2026-05-18 01:12:15 |
| 合計ジャッジ時間 | 4,058 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
from collections import deque
n=int(input())
a=deque(list(map(int,input().split())))
if a[0]>a[-1]:
print("No");exit()
b=deque()
print("Yes");ans=[]
while len(a)>1:
c=a.pop()
while a and a[-1]<c:
if len(a)==1:
ans.append(c)
c=a.pop()
break
else:
ans.append(a.pop())
b.append(c)
if a:
c=a.pop()
else:
c=b.pop()
while b:
ans.append(b.pop())
print(" ".join(map(str,ans)))