結果

問題 No.482 あなたの名は
ユーザー suppy193suppy193
提出日時 2017-02-12 00:29:35
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 231 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 11,360 KB
実行使用メモリ 29,288 KB
最終ジャッジ日時 2023-08-28 14:49:30
合計ジャッジ時間 5,994 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,140 KB
testcase_01 AC 77 ms
15,172 KB
testcase_02 AC 80 ms
15,224 KB
testcase_03 AC 76 ms
15,160 KB
testcase_04 AC 78 ms
15,104 KB
testcase_05 WA -
testcase_06 AC 78 ms
15,216 KB
testcase_07 AC 80 ms
15,244 KB
testcase_08 WA -
testcase_09 AC 78 ms
15,228 KB
testcase_10 AC 77 ms
15,052 KB
testcase_11 AC 80 ms
15,140 KB
testcase_12 AC 78 ms
15,264 KB
testcase_13 AC 78 ms
15,048 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 167 ms
29,064 KB
testcase_17 AC 166 ms
29,076 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 167 ms
28,936 KB
testcase_25 AC 166 ms
29,176 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 168 ms
29,188 KB
testcase_29 AC 167 ms
28,940 KB
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, k = gets.strip.split(' ').map(&:to_i)
d = gets.strip.split(' ').map(&:to_i)
count = 0
(1..n).each do |i|
	count += 1 if d[i - 1] != i
end
if k < count / 2
	puts "NO"
elsif k % 2 == (count / 2) % 2
	puts "YES"
else
	puts "NO"
end
0