結果

問題 No.930 数列圧縮
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-05-07 22:52:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 104,228 KB
最終ジャッジ日時 2023-09-21 10:53:52
合計ジャッジ時間 6,200 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,248 KB
testcase_01 AC 69 ms
71,628 KB
testcase_02 AC 66 ms
71,384 KB
testcase_03 AC 68 ms
71,272 KB
testcase_04 AC 70 ms
71,440 KB
testcase_05 AC 77 ms
76,692 KB
testcase_06 AC 68 ms
71,192 KB
testcase_07 AC 83 ms
76,768 KB
testcase_08 AC 106 ms
93,188 KB
testcase_09 AC 117 ms
94,236 KB
testcase_10 AC 110 ms
93,356 KB
testcase_11 AC 116 ms
91,760 KB
testcase_12 AC 121 ms
97,592 KB
testcase_13 AC 97 ms
86,548 KB
testcase_14 AC 100 ms
85,112 KB
testcase_15 AC 115 ms
101,668 KB
testcase_16 AC 122 ms
104,228 KB
testcase_17 AC 128 ms
91,356 KB
testcase_18 AC 127 ms
91,592 KB
testcase_19 AC 125 ms
91,236 KB
testcase_20 AC 127 ms
91,580 KB
testcase_21 AC 123 ms
101,572 KB
testcase_22 AC 67 ms
71,512 KB
testcase_23 AC 114 ms
101,720 KB
testcase_24 AC 69 ms
71,304 KB
testcase_25 AC 68 ms
71,336 KB
testcase_26 AC 69 ms
71,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int,input().split()))
start = A[0]
l = []
rest = []
for a in A[1:]:
    while rest and rest[-1] < a:
        l.append(rest.pop())

    if start < a:
        l.append(a)
    else:
        rest.append(a)

if rest:
    print("No")
else:
    print("Yes")
    print(*l)
0