結果
| 問題 | No.1707 Simple Range Reverse Problem |
| コンテスト | |
| ユーザー |
kou_kkk
|
| 提出日時 | 2026-11-02 17:09:19 |
| 言語 | Nim (2.2.12 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 530 bytes |
| 記録 | |
| コンパイル時間 | 2,565 ms |
| コンパイル使用メモリ | 70,176 KB |
| 実行使用メモリ | 9,908 KB |
| 最終ジャッジ日時 | 2026-11-02 17:09:24 |
| 合計ジャッジ時間 | 4,873 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 17 WA * 3 |
ソースコード
import sequtils, strutils
proc solve(): bool =
let
n = parseInt readLine stdin
a = stdin.readLine.split.map parseInt
var
l = 0
r = a.high
x1 = 1
x2 = n
if a[0] != 1: return false
if a[^1] != n: return false
while a[l] == x1:
inc l
inc x1
while r >= 0 and a[r] == x2:
dec r
dec x2
while a[l] == x2:
inc l
dec x2
while r >= 0 and a[r] == x1:
dec r
inc x1
return l > r
let t = parseInt readLine stdin
for _ in 0 ..< t:
echo if solve(): "Yes" else: "No"
kou_kkk