結果

問題 No.59 鉄道の旅
ユーザー cielciel
提出日時 2015-04-24 04:35:03
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,154 ms / 5,000 ms
コード長 169 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 11,248 KB
実行使用メモリ 16,916 KB
最終ジャッジ日時 2023-08-27 05:32:56
合計ジャッジ時間 4,256 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,080 KB
testcase_01 AC 82 ms
15,184 KB
testcase_02 AC 82 ms
15,012 KB
testcase_03 AC 81 ms
15,100 KB
testcase_04 AC 363 ms
16,356 KB
testcase_05 AC 81 ms
15,076 KB
testcase_06 AC 81 ms
15,296 KB
testcase_07 AC 81 ms
15,216 KB
testcase_08 AC 101 ms
15,392 KB
testcase_09 AC 101 ms
15,316 KB
testcase_10 AC 103 ms
15,296 KB
testcase_11 AC 101 ms
15,440 KB
testcase_12 AC 237 ms
16,084 KB
testcase_13 AC 509 ms
16,560 KB
testcase_14 AC 1,154 ms
16,916 KB
testcase_15 AC 82 ms
14,992 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N,K=gets.split.map &:to_i
a=[]
$<.map{|e|n=e.to_i
t=(0...a.size).bsearch{|i|a[i]>=n.abs}||a.size
a.delete_at(t)if n<0&&a[t]==-n
a.insert(t,n)if n>0&&a.size-t<K}
p a.size
0