結果
問題 | No.1707 Simple Range Reverse Problem |
ユーザー |
|
提出日時 | 2021-10-16 18:58:08 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 903 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 81,972 KB |
実行使用メモリ | 87,356 KB |
最終ジャッジ日時 | 2024-09-17 19:30:35 |
合計ジャッジ時間 | 3,102 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 WA * 13 |
ソースコード
#!/usr/bin/env python3# from typing import *import sysimport ioimport mathimport collectionsimport decimalimport itertoolsimport bisectimport heapqdef input():return sys.stdin.readline()[:-1]# sys.setrecursionlimit(1000000)# _INPUT = """# paste here...# """# sys.stdin = io.StringIO(_INPUT)INF = 10**10YES = 'Yes'NO = 'No'def solve(N, A):N //= 2for i in range(2*N):if A[i] != i % N:if i == 0:return 'No'for j in range(i+1, 2*N):if A[j] == A[i-1]:if A[j-1] != i % N:return 'No'A = A[:i] + A[j-1:i-1:-1] + A[j:]breakelse:return 'No'return 'Yes'T0 = int(input())for _ in range(T0):N = int(input())A = list(map(int, input().split()))print(solve(N//2, A))