結果

問題 No.2210 equence Squence Seuence
ユーザー FromBooskaFromBooska
提出日時 2023-03-05 12:55:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,723 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 81,732 KB
実行使用メモリ 114,232 KB
最終ジャッジ日時 2023-10-18 04:52:23
合計ジャッジ時間 6,776 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,436 KB
testcase_01 AC 38 ms
53,436 KB
testcase_02 AC 39 ms
53,436 KB
testcase_03 AC 72 ms
82,492 KB
testcase_04 WA -
testcase_05 AC 83 ms
89,880 KB
testcase_06 AC 79 ms
86,908 KB
testcase_07 AC 117 ms
108,248 KB
testcase_08 AC 39 ms
53,448 KB
testcase_09 AC 39 ms
53,448 KB
testcase_10 AC 39 ms
53,448 KB
testcase_11 WA -
testcase_12 AC 38 ms
53,448 KB
testcase_13 AC 128 ms
112,240 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 128 ms
112,240 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 38 ms
53,448 KB
testcase_20 AC 38 ms
53,448 KB
testcase_21 AC 38 ms
53,448 KB
testcase_22 WA -
testcase_23 AC 106 ms
105,544 KB
testcase_24 AC 95 ms
98,948 KB
testcase_25 AC 101 ms
102,068 KB
testcase_26 AC 119 ms
113,416 KB
testcase_27 AC 71 ms
84,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 入力例2, K=3, A=[3, 1, 4, 1, 5]
# それぞれの数字を選ぶか選ばないか決めていく
# 選ばない数字が決まったら終わり
# 最初の3. 3を選ぶ組合せは4通り、次の1を選ぶ組合せ(3を選ばない)は1通り
# 1の方が先なので、1で1通り、K=3は4の方に入っているので4を選ぶ
# 先を選ばなかったのでK -= 1でK=2
# 次に1。1を選ぶ組合せは3通り、1を選ばず次の4を選ぶ組合せは1通り
# K=2は、1<4であり、1を選ぶ組合せ側に入っているので1を選ぶ
# Kは2で変わらず
# 3番目に4.4を選ぶ組合せは2通り、4を選ばずに次の1を選ぶ組合せは1通り
# K=2は、まず、1で1通り使って(K-=1)、4の側にあるので4を選ぶ
# Kは1となった
# 4番目に1. 1を選ぶ組合せは1通り。1を選ばずに次の5を選ぶ組合せは1通り
# 1<5であり、K=1は1を選ぶ組合せに入っているので1を選ぶ
# これで最後まで来たので5は選ばない
# 終了
# 次の数字と同じ場合はその数字を選ぶこと

N, K = map(int, input().split())
A = list(map(int, input().split()))

skip = -1
K_remainder = K
for i in range(0, N-1):
    if skip >= 0:
        break
    
    if A[i] <= A[i+1]:
        if K_remainder <= N-1-i:
            # choose A[i]
            pass 
        else: 
            skip = i
            break
    elif A[i] > A[i+1]:
        if K_remainder <= 1:
            skip = i
            break
        else:
            K_remainder -= 1
            
    #print('K_remainder', K_remainder, 'skip', skip)
    
if skip == -1:
    skip = N-1
    
#print('K_remainder', K_remainder, 'skip', skip)

ans = A[:skip] + A[skip+1:]
print(*ans)
0