結果

問題 No.411 昇順昇順ソート
ユーザー abL8ZLsTbFabL8ZLsTbF
提出日時 2016-10-18 18:52:52
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 224 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 18,688 KB
最終ジャッジ日時 2024-05-02 02:43:19
合計ジャッジ時間 7,001 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
17,920 KB
testcase_01 AC 102 ms
12,288 KB
testcase_02 AC 88 ms
12,288 KB
testcase_03 AC 98 ms
12,160 KB
testcase_04 AC 101 ms
12,416 KB
testcase_05 AC 99 ms
12,288 KB
testcase_06 AC 102 ms
12,416 KB
testcase_07 AC 97 ms
12,416 KB
testcase_08 AC 98 ms
12,288 KB
testcase_09 AC 95 ms
12,544 KB
testcase_10 AC 98 ms
12,288 KB
testcase_11 AC 96 ms
12,288 KB
testcase_12 AC 97 ms
12,288 KB
testcase_13 AC 93 ms
12,288 KB
testcase_14 AC 97 ms
12,288 KB
testcase_15 AC 97 ms
12,416 KB
testcase_16 AC 99 ms
12,416 KB
testcase_17 AC 106 ms
12,160 KB
testcase_18 AC 96 ms
12,416 KB
testcase_19 AC 95 ms
12,416 KB
testcase_20 AC 95 ms
12,160 KB
testcase_21 AC 94 ms
12,160 KB
testcase_22 AC 97 ms
12,160 KB
testcase_23 AC 97 ms
12,288 KB
testcase_24 AC 94 ms
12,160 KB
testcase_25 AC 95 ms
12,032 KB
testcase_26 AC 92 ms
12,288 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, K = gets.split.map(&:to_i)
arr = Array.new
1.upto(N) do |i|
	arr.push(i)
end
ans = 0
arr.permutation(N) do |i|
	rev = 0
	0.upto(N - 2) do |j|
		rev += 1 if i[j] > i[j + 1]
	end
	ans += 1 if rev == 1 && i[0] == K
end
p ans
0