結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
zazaboon
|
| 提出日時 | 2017-02-10 22:42:50 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 286 bytes |
| 記録 | |
| コンパイル時間 | 962 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 38,912 KB |
| 最終ジャッジ日時 | 2024-12-28 08:02:12 |
| 合計ジャッジ時間 | 48,624 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 3 TLE * 15 |
コンパイルメッセージ
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
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"
zazaboon