結果

問題 No.366 ロボットソート
ユーザー hogeover30hogeover30
提出日時 2017-01-28 01:47:19
言語 Ruby
(3.3.0)
結果
AC  
実行時間 246 ms / 2,000 ms
コード長 137 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 11,440 KB
実行使用メモリ 15,604 KB
最終ジャッジ日時 2023-08-28 15:31:58
合計ジャッジ時間 3,390 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,144 KB
testcase_01 AC 77 ms
15,032 KB
testcase_02 AC 78 ms
15,168 KB
testcase_03 AC 77 ms
15,320 KB
testcase_04 AC 77 ms
15,176 KB
testcase_05 AC 79 ms
15,168 KB
testcase_06 AC 78 ms
15,312 KB
testcase_07 AC 78 ms
15,112 KB
testcase_08 AC 78 ms
15,244 KB
testcase_09 AC 77 ms
15,188 KB
testcase_10 AC 79 ms
15,080 KB
testcase_11 AC 134 ms
15,296 KB
testcase_12 AC 158 ms
15,312 KB
testcase_13 AC 84 ms
15,316 KB
testcase_14 AC 84 ms
15,080 KB
testcase_15 AC 81 ms
15,180 KB
testcase_16 AC 91 ms
15,176 KB
testcase_17 AC 102 ms
15,112 KB
testcase_18 AC 155 ms
15,604 KB
testcase_19 AC 103 ms
15,492 KB
testcase_20 AC 78 ms
15,084 KB
testcase_21 AC 163 ms
15,388 KB
testcase_22 AC 246 ms
15,488 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

eval'N,K,*A='+$<.read.split*?,
r=0
N.times{(N-K).times{|i|A[i]>A[j=i+K]&&(r+=1;A[i],A[j]=A[j],A[i])}}
p (1...N).all?{|i|A[i-1]<A[i]}?r:-1
0