結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2017-02-10 22:39:23 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 266 bytes |
コンパイル時間 | 503 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 26,624 KB |
最終ジャッジ日時 | 2024-12-28 07:51:04 |
合計ジャッジ時間 | 6,114 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 11 |
コンパイルメッセージ
Syntax OK
ソースコード
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"