結果
| 問題 | No.1707 Simple Range Reverse Problem |
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-10-16 10:54:14 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 407 bytes |
| 記録 | |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-09-17 19:19:02 |
| 合計ジャッジ時間 | 3,620 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 WA * 5 |
コンパイルメッセージ
Syntax OK
ソースコード
T = gets.to_i
T.times do
n = gets.to_i
a = gets.split.map(&:to_i)
if a[0] != 1 || a[-1] != n
puts 'No'
else
ok = true
1.upto(2 * n - 2) do |i|
y = a[i - 1]
x = a[i]
z = a[i + 1]
next if y == x - 1 || y == (x % n) + 1
next if z == x - 1 || z == (x % n) + 1
ok = false
end
if ok
puts 'Yes'
else
puts 'No'
end
end
end
siman