結果

問題 No.930 数列圧縮
ユーザー ayaoniayaoni
提出日時 2021-08-31 16:01:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 87,364 KB
実行使用メモリ 104,196 KB
最終ジャッジ日時 2023-08-17 04:09:49
合計ジャッジ時間 6,229 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,136 KB
testcase_01 AC 74 ms
71,292 KB
testcase_02 AC 72 ms
71,424 KB
testcase_03 AC 78 ms
71,528 KB
testcase_04 AC 75 ms
71,460 KB
testcase_05 AC 84 ms
76,668 KB
testcase_06 AC 73 ms
71,180 KB
testcase_07 AC 83 ms
76,728 KB
testcase_08 AC 118 ms
94,564 KB
testcase_09 AC 116 ms
97,024 KB
testcase_10 AC 108 ms
92,768 KB
testcase_11 AC 110 ms
93,836 KB
testcase_12 AC 117 ms
98,608 KB
testcase_13 AC 80 ms
82,032 KB
testcase_14 AC 84 ms
83,448 KB
testcase_15 AC 119 ms
103,048 KB
testcase_16 AC 122 ms
102,772 KB
testcase_17 AC 121 ms
102,868 KB
testcase_18 AC 122 ms
103,320 KB
testcase_19 AC 124 ms
103,160 KB
testcase_20 AC 121 ms
103,312 KB
testcase_21 AC 123 ms
104,196 KB
testcase_22 AC 71 ms
71,180 KB
testcase_23 AC 121 ms
103,108 KB
testcase_24 AC 72 ms
70,996 KB
testcase_25 AC 73 ms
71,396 KB
testcase_26 AC 73 ms
71,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N = I()
A = LI()

if A[0] > A[-1]:
    print('No')
    exit()
print('Yes')

ANS0 = []
ANS1 = []
a0 = A[0]
for i in range(1,N-1):
    a = A[i]
    if a > a0:
        ANS0.append(a)
    else:
        ANS1.append(a)

ANS = ANS0+ANS1[::-1]+[a0]
print(*ANS)
0