結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,068 KB
testcase_01 AC 88 ms
15,068 KB
testcase_02 AC 84 ms
15,120 KB
testcase_03 AC 143 ms
19,900 KB
testcase_04 WA -
testcase_05 AC 187 ms
20,464 KB
testcase_06 AC 167 ms
20,868 KB
testcase_07 AC 297 ms
31,560 KB
testcase_08 AC 83 ms
15,004 KB
testcase_09 AC 85 ms
15,024 KB
testcase_10 AC 84 ms
15,256 KB
testcase_11 WA -
testcase_12 AC 84 ms
15,256 KB
testcase_13 WA -
testcase_14 AC 348 ms
33,496 KB
testcase_15 AC 348 ms
33,496 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 84 ms
15,088 KB
testcase_20 AC 83 ms
15,240 KB
testcase_21 AC 85 ms
15,148 KB
testcase_22 AC 84 ms
15,140 KB
testcase_23 AC 295 ms
31,328 KB
testcase_24 AC 243 ms
25,908 KB
testcase_25 AC 267 ms
29,440 KB
testcase_26 AC 332 ms
32,544 KB
testcase_27 AC 155 ms
20,600 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

k = 0
idx = -1
same_cnt = 1

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

    if k >= K
      idx = i
    end
  end

  if a == na
    same_cnt += 1
  else
    same_cnt = 1
  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