結果
問題 | No.1779 Magical Swap |
ユーザー | siman |
提出日時 | 2021-12-08 06:52:50 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 519 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 11,220 KB |
実行使用メモリ | 19,680 KB |
最終ジャッジ日時 | 2023-09-22 21:06:50 |
合計ジャッジ時間 | 5,100 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 79 ms
15,232 KB |
testcase_01 | TLE | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
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 i = 3 ok = true checked = Array.new(n + 1, false) while i <= n && ok next if checked[i] if 2 * i <= n i.step(n, i) do |j| checked[j] = true end end ok = false if !checked[i] && a[i - 1] != b[i - 1] i += 2 end if ok puts 'Yes' else puts 'No' end end end