結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,156 KB
testcase_01 AC 83 ms
15,168 KB
testcase_02 AC 88 ms
15,108 KB
testcase_03 AC 140 ms
19,704 KB
testcase_04 AC 148 ms
20,260 KB
testcase_05 AC 183 ms
20,568 KB
testcase_06 AC 167 ms
20,608 KB
testcase_07 AC 296 ms
31,580 KB
testcase_08 AC 82 ms
15,028 KB
testcase_09 AC 87 ms
15,124 KB
testcase_10 AC 83 ms
15,080 KB
testcase_11 AC 86 ms
15,088 KB
testcase_12 AC 85 ms
15,360 KB
testcase_13 AC 348 ms
33,524 KB
testcase_14 AC 344 ms
33,576 KB
testcase_15 AC 348 ms
33,424 KB
testcase_16 AC 342 ms
33,304 KB
testcase_17 AC 344 ms
33,412 KB
testcase_18 AC 84 ms
15,148 KB
testcase_19 WA -
testcase_20 AC 84 ms
15,232 KB
testcase_21 AC 82 ms
15,296 KB
testcase_22 AC 83 ms
15,040 KB
testcase_23 AC 293 ms
31,604 KB
testcase_24 AC 244 ms
25,980 KB
testcase_25 AC 268 ms
29,740 KB
testcase_26 AC 332 ms
32,196 KB
testcase_27 AC 152 ms
20,572 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