結果

問題 No.1707 Simple Range Reverse Problem
ユーザー titan23titan23
提出日時 2022-06-21 13:40:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 75,920 KB
最終ジャッジ日時 2024-04-22 07:46:17
合計ジャッジ時間 2,271 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,972 KB
testcase_01 AC 48 ms
61,848 KB
testcase_02 AC 46 ms
61,224 KB
testcase_03 AC 46 ms
61,284 KB
testcase_04 AC 47 ms
62,560 KB
testcase_05 AC 46 ms
63,604 KB
testcase_06 AC 45 ms
61,684 KB
testcase_07 AC 46 ms
62,480 KB
testcase_08 AC 46 ms
62,716 KB
testcase_09 AC 57 ms
75,704 KB
testcase_10 AC 55 ms
75,492 KB
testcase_11 AC 47 ms
64,400 KB
testcase_12 AC 58 ms
75,372 KB
testcase_13 AC 61 ms
75,560 KB
testcase_14 AC 62 ms
75,732 KB
testcase_15 AC 69 ms
75,564 KB
testcase_16 AC 63 ms
75,472 KB
testcase_17 AC 60 ms
75,860 KB
testcase_18 AC 64 ms
75,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import Counter
input = lambda: sys.stdin.readline().rstrip()

##################

def main():
  n = int(input())
  A = list(map(int, input().split()))
  X = list(range(1, n+1)) + list(range(1, n+1))
  if A == X:
    return 'Yes'
  for i in range(0, n+1):
    if X[:i] + X[i+n:i:-1] + X[i+n:] == A:
      return 'Yes'
  return 'No'

t = int(input())
for _ in range(t):
  print(main())
0