結果
問題 |
No.930 数列圧縮
|
ユーザー |
|
提出日時 | 2019-11-24 16:43:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 558 bytes |
コンパイル時間 | 91 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 24,116 KB |
最終ジャッジ日時 | 2024-10-12 04:19:17 |
合計ジャッジ時間 | 5,987 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | WA * 8 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 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()