結果
| 問題 |
No.1779 Magical Swap
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-12-08 06:52:50 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 519 bytes |
| コンパイル時間 | 130 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 19,232 KB |
| 最終ジャッジ日時 | 2024-07-08 11:42:38 |
| 合計ジャッジ時間 | 3,983 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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