結果

問題 No.1707 Simple Range Reverse Problem
ユーザー wolgnikwolgnik
提出日時 2021-10-15 21:50:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 81,740 KB
実行使用メモリ 74,740 KB
最終ジャッジ日時 2023-10-17 20:14:25
合計ジャッジ時間 3,314 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,352 KB
testcase_01 AC 44 ms
59,344 KB
testcase_02 AC 42 ms
59,344 KB
testcase_03 AC 43 ms
59,344 KB
testcase_04 AC 43 ms
61,392 KB
testcase_05 AC 42 ms
61,392 KB
testcase_06 AC 42 ms
59,344 KB
testcase_07 AC 43 ms
59,344 KB
testcase_08 AC 42 ms
59,344 KB
testcase_09 AC 53 ms
74,708 KB
testcase_10 AC 52 ms
74,712 KB
testcase_11 AC 43 ms
63,440 KB
testcase_12 AC 56 ms
74,716 KB
testcase_13 AC 61 ms
74,716 KB
testcase_14 AC 59 ms
74,708 KB
testcase_15 AC 67 ms
74,736 KB
testcase_16 AC 62 ms
74,716 KB
testcase_17 AC 58 ms
74,712 KB
testcase_18 AC 62 ms
74,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
for _ in range(int(input())):
  N = int(input())
  a = list(map(int, input().split()))

  p = list(range(1, N + 1)) * 2
  if a == p:
    print("Yes")
    continue
  for i in range(N):
    if a == p[: i + 1] + p[i + 1: i + N][: : -1] + p[i + N: ]: break
  else:
    print("No")
    continue
  print("Yes")
0