結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,072 KB
testcase_01 AC 82 ms
15,048 KB
testcase_02 AC 81 ms
15,092 KB
testcase_03 AC 80 ms
15,244 KB
testcase_04 AC 78 ms
15,324 KB
testcase_05 AC 79 ms
15,144 KB
testcase_06 AC 79 ms
15,232 KB
testcase_07 AC 79 ms
15,148 KB
testcase_08 WA -
testcase_09 AC 78 ms
15,180 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 79 ms
15,248 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 172 ms
28,968 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 174 ms
29,032 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 173 ms
29,008 KB
testcase_24 AC 173 ms
29,064 KB
testcase_25 AC 179 ms
29,068 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 172 ms
29,184 KB
testcase_29 AC 171 ms
29,072 KB
testcase_30 AC 82 ms
15,320 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
puts ((k - (count))%2 == 0)? "YES" : "NO"
0