結果
問題 |
No.930 数列圧縮
|
ユーザー |
|
提出日時 | 2019-11-24 16:44:05 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 575 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 22,416 KB |
最終ジャッジ日時 | 2024-10-12 04:19:23 |
合計ジャッジ時間 | 5,576 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 2 WA * 6 TLE * 1 -- * 15 |
ソースコード
def solve(): N = int(input()) a = [int(x) for x in input().split(" ")] last = a.pop() cnt = sum([x < y for x, y in zip(a, a[1:])]) if last < N - cnt: print("No") return print("Yes") res = [] for _ in range(cnt): for i, v in enumerate(zip(a, a[1:])): x, y = v if x > y: continue if last < y: res.append(a.pop(i+1)) break res += list(reversed(a)) print(" ".join([str(x) for x in res])) if __name__ == "__main__": solve()