結果

問題 No.930 数列圧縮
ユーザー ああいいああいい
提出日時 2022-01-01 21:04:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 393,792 KB
最終ジャッジ日時 2024-04-18 20:56:26
合計ジャッジ時間 8,441 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 32 ms
10,880 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 44 ms
15,896 KB
testcase_14 AC 49 ms
17,192 KB
testcase_15 RE -
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = list(map(int,input().split()))

import sys
if a[0] > a[-1]:
    print('No')
    exit()
print('Yes')

def calc(l,flag = True):
    if len(l) == 2:
        print(l[0])
        exit()
    s = []
    if flag:
        now = l[0]
        s.append(now)
        for i in range(1,len(l)-1):
            if l[i] > now:
                print(l[i],end = " ")
            else:
                s.append(l[i])
                now = l[i]
        calc(s,False)
    else:
        now = l[-1]
        s.append(now)
        for i in reversed(range(1,len(l)-1)):
            if l[i] < now:
                print(l[i],end = " ")
            else:
                s.append(l[i])
                now = l[i]
                
        calc(s[::-1],True)
calc(a,True)
0