結果

問題 No.482 あなたの名は
ユーザー zazaboonzazaboon
提出日時 2017-02-10 22:42:50
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 286 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 11,400 KB
実行使用メモリ 33,392 KB
最終ジャッジ日時 2023-08-27 22:46:01
合計ジャッジ時間 5,972 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
19,672 KB
testcase_01 AC 79 ms
15,356 KB
testcase_02 AC 81 ms
15,260 KB
testcase_03 AC 79 ms
15,080 KB
testcase_04 AC 81 ms
15,144 KB
testcase_05 WA -
testcase_06 AC 81 ms
15,048 KB
testcase_07 AC 81 ms
15,180 KB
testcase_08 AC 79 ms
15,088 KB
testcase_09 AC 79 ms
15,088 KB
testcase_10 AC 80 ms
15,356 KB
testcase_11 AC 80 ms
15,308 KB
testcase_12 WA -
testcase_13 AC 80 ms
15,264 KB
testcase_14 AC 81 ms
15,084 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
count = 0
(0..(n-1)).each do |d|
  if(a[d] != (d+1))
    count += 1 
    ind = a.index(d+1)
    a[ind] = a[d]
  end
end
test = k - (count)
if (test < 0)
  puts "NO"
  exit
end
puts (test%2 == 0)? "YES" : "NO"
0