結果
問題 | No.1707 Simple Range Reverse Problem |
ユーザー |
![]() |
提出日時 | 2023-02-13 11:49:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,358 bytes |
コンパイル時間 | 206 ms |
コンパイル使用メモリ | 82,012 KB |
実行使用メモリ | 63,236 KB |
最終ジャッジ日時 | 2024-07-16 09:47:55 |
合計ジャッジ時間 | 2,130 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 WA * 6 |
ソースコード
import sys# sys.setrecursionlimit(200005)int1 = lambda x: int(x)-1pDB = lambda *x: print(*x, end="\n", file=sys.stderr)p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)def II(): return int(sys.stdin.readline())def LI(): return list(map(int, sys.stdin.readline().split()))def LLI(rows_number): return [LI() for _ in range(rows_number)]def LI1(): return list(map(int1, sys.stdin.readline().split()))def LLI1(rows_number): return [LI1() for _ in range(rows_number)]def SI(): return sys.stdin.readline().rstrip()# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]inf = (1 << 63)-1# inf = (1 << 31)-1# md = 10**9+7# md = 998244353from collections import Counterdef ok():n = II()aa = LI1()xx = list(range(n))xx *= 2if aa == xx: return Trueac = Counter(aa)for a in range(n):if ac[a] != 2: return Falseif aa[0] != 0: return Falsej = 1while aa[j] != 0: j += 1if j & 1: return Falsefor i in range((j+2)//2):if aa[i] != aa[j-i] or aa[i] != i: return Falsei, j = 2*n-1, j+1a = n-1while j <= i:if aa[j] != aa[i] or aa[j] != a: return Falsej += 1i -= 1a -= 1return Truefor _ in range(II()):print("Yes" if ok() else "No")