結果

問題 No.930 数列圧縮
ユーザー tassei903tassei903
提出日時 2021-10-10 23:44:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 770 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 108,616 KB
最終ジャッジ日時 2023-10-12 21:43:12
合計ジャッジ時間 7,416 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 129 ms
108,616 KB
testcase_16 AC 132 ms
102,240 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 73 ms
71,152 KB
testcase_23 AC 124 ms
102,204 KB
testcase_24 AC 72 ms
71,304 KB
testcase_25 AC 71 ms
71,312 KB
testcase_26 AC 73 ms
71,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

n = ni()
a = [i-1 for i in na()]
b = n-1
z = []
ans = []
for i in range(n):
    if a[i]==b:
        if len(z)==0:
            No()
            exit()
        for j in range(len(z)-1):
            ans.append(z.pop()+1)
        ans.append(b+1)
        b-=1
        if i!=n-1 and len(z)!=0 and b==z[0]:
            No()
            exit()
    else:
        z.append(a[i])
Yes()
print(*ans)
0