結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,312 KB
testcase_01 WA -
testcase_02 AC 77 ms
15,304 KB
testcase_03 AC 76 ms
15,028 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 77 ms
15,248 KB
testcase_08 AC 77 ms
15,116 KB
testcase_09 AC 78 ms
15,248 KB
testcase_10 AC 78 ms
15,388 KB
testcase_11 AC 79 ms
15,036 KB
testcase_12 AC 78 ms
15,340 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 189 ms
30,832 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 190 ms
30,720 KB
testcase_20 WA -
testcase_21 AC 189 ms
30,688 KB
testcase_22 WA -
testcase_23 AC 194 ms
30,640 KB
testcase_24 WA -
testcase_25 AC 188 ms
30,624 KB
testcase_26 WA -
testcase_27 AC 189 ms
30,384 KB
testcase_28 WA -
testcase_29 AC 194 ms
30,556 KB
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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