結果

問題 No.2210 equence Squence Seuence
ユーザー simansiman
提出日時 2023-02-12 07:53:07
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 390 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 11,280 KB
実行使用メモリ 33,636 KB
最終ジャッジ日時 2023-09-23 01:22:30
合計ジャッジ時間 8,016 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,092 KB
testcase_01 AC 79 ms
15,304 KB
testcase_02 AC 78 ms
15,148 KB
testcase_03 AC 132 ms
20,032 KB
testcase_04 WA -
testcase_05 AC 173 ms
20,432 KB
testcase_06 AC 157 ms
20,880 KB
testcase_07 AC 285 ms
31,620 KB
testcase_08 AC 78 ms
15,168 KB
testcase_09 AC 78 ms
15,148 KB
testcase_10 AC 78 ms
15,288 KB
testcase_11 WA -
testcase_12 AC 80 ms
15,300 KB
testcase_13 AC 334 ms
33,440 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 331 ms
33,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 78 ms
15,132 KB
testcase_20 AC 79 ms
15,024 KB
testcase_21 AC 78 ms
15,104 KB
testcase_22 WA -
testcase_23 AC 281 ms
31,296 KB
testcase_24 AC 231 ms
26,052 KB
testcase_25 AC 262 ms
29,576 KB
testcase_26 AC 316 ms
32,504 KB
testcase_27 AC 145 ms
20,760 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

k = 0
idx = -1

A.each_cons(2).with_index do |(a, na), i|
  if a > na
    k += 1

    if k == K
      idx = i
    end
  end
end

k += 1
if k == K
  idx = N - 1
end

A.reverse.each_cons(2).with_index do |(a, na), i|
  if a >= na
    k += 1

    if k == K
      idx = (N - 2) - i
    end
  end
end

A.delete_at(idx)

puts A.join(' ')
0