結果
| 問題 | No.1707 Simple Range Reverse Problem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-15 21:31:07 |
| 言語 | Ruby (4.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 365 bytes |
| 記録 | |
| コンパイル時間 | 392 ms |
| コンパイル使用メモリ | 8,704 KB |
| 実行使用メモリ | 22,144 KB |
| 最終ジャッジ日時 | 2026-04-06 09:31:48 |
| 合計ジャッジ時間 | 2,166 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 12 WA * 6 RE * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
T = gets.to_s.to_i
T.times do
n = gets.to_s.to_i
a = gets.to_s.split.map { |s| s.to_i }
if (0 ... n * 2).all? { |i| a[i] == i % n + 1 }
puts "Yes"
next
end
i = a.rindex(1)
xs = a[0 .. i]
ys = a[i + 1 ..]
if xs.reverse == xs and ys.reverse == ys
puts "Yes"
next
end
puts "No"
end