結果

問題 No.482 あなたの名は
ユーザー zazaboonzazaboon
提出日時 2017-02-10 22:39:23
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 266 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 11,340 KB
実行使用メモリ 29,332 KB
最終ジャッジ日時 2023-08-27 22:42:11
合計ジャッジ時間 6,139 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,136 KB
testcase_01 AC 79 ms
15,132 KB
testcase_02 AC 79 ms
15,048 KB
testcase_03 AC 78 ms
15,240 KB
testcase_04 AC 79 ms
15,048 KB
testcase_05 AC 77 ms
15,100 KB
testcase_06 AC 77 ms
15,252 KB
testcase_07 AC 79 ms
15,172 KB
testcase_08 WA -
testcase_09 AC 79 ms
15,212 KB
testcase_10 AC 78 ms
15,324 KB
testcase_11 AC 79 ms
15,136 KB
testcase_12 WA -
testcase_13 AC 79 ms
15,116 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 172 ms
29,164 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 174 ms
29,044 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 172 ms
28,980 KB
testcase_24 AC 171 ms
29,140 KB
testcase_25 AC 172 ms
29,132 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 177 ms
28,976 KB
testcase_29 AC 172 ms
29,208 KB
testcase_30 AC 84 ms
15,092 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 
    a[a[d]-1] = a[d]
  end
end
test = k - (count)
if (test < 0)
  puts "NO"
  exit
end
puts (test%2 == 0)? "YES" : "NO"
0