結果

問題 No.1779 Magical Swap
ユーザー simansiman
提出日時 2021-12-08 06:37:47
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 279 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 11,536 KB
実行使用メモリ 30,904 KB
最終ジャッジ日時 2023-09-22 20:48:36
合計ジャッジ時間 4,859 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,136 KB
testcase_01 AC 77 ms
15,128 KB
testcase_02 AC 93 ms
15,372 KB
testcase_03 WA -
testcase_04 AC 139 ms
21,852 KB
testcase_05 AC 104 ms
19,656 KB
testcase_06 AC 106 ms
20,532 KB
testcase_07 AC 129 ms
21,644 KB
testcase_08 AC 80 ms
15,404 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 352 ms
15,168 KB
testcase_16 AC 153 ms
28,916 KB
testcase_17 WA -
testcase_18 AC 77 ms
15,172 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 2.step(n, 2).all? { |i| i < n / 2 || a[i] == b[i] }
      puts 'Yes'
    else
      puts 'No'
    end
  end
end
0