結果

問題 No.1779 Magical Swap
ユーザー simansiman
提出日時 2021-12-08 06:43:24
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 288 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 11,472 KB
実行使用メモリ 31,268 KB
最終ジャッジ日時 2023-09-22 20:55:19
合計ジャッジ時間 4,596 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,336 KB
testcase_01 AC 78 ms
15,024 KB
testcase_02 AC 95 ms
15,504 KB
testcase_03 WA -
testcase_04 AC 136 ms
21,824 KB
testcase_05 AC 105 ms
19,648 KB
testcase_06 AC 107 ms
20,472 KB
testcase_07 AC 129 ms
21,620 KB
testcase_08 AC 80 ms
15,116 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 351 ms
15,244 KB
testcase_16 AC 152 ms
28,760 KB
testcase_17 WA -
testcase_18 AC 78 ms
15,080 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

T = gets.to_i

T.times do
  n = gets.to_i
  a = gets.split.map(&:to_i)
  b = gets.split.map(&:to_i)

  if a[0] != b[0] || a.sort != b.sort
    puts 'No'
  else
    if 3.step(n, 2).all? { |i| 2 * i <= n || a[i - 1] == b[i - 1] }
      puts 'Yes'
    else
      puts 'No'
    end
  end
end
0