結果
| 問題 | No.1779 Magical Swap |
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-12-08 06:52:50 |
| 言語 | Ruby (4.0.2) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 519 bytes |
| 記録 | |
| コンパイル時間 | 417 ms |
| コンパイル使用メモリ | 8,704 KB |
| 実行使用メモリ | 14,592 KB |
| 最終ジャッジ日時 | 2026-08-12 17:39:32 |
| 合計ジャッジ時間 | 5,740 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | TLE * 1 -- * 17 |
コンパイルメッセージ
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
siman