結果

問題 No.1707 Simple Range Reverse Problem
ユーザー tassei903tassei903
提出日時 2021-10-15 21:35:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 892 bytes
コンパイル時間 564 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 70,680 KB
最終ジャッジ日時 2023-10-17 20:05:45
合計ジャッジ時間 2,679 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,500 KB
testcase_01 AC 58 ms
66,516 KB
testcase_02 AC 57 ms
66,420 KB
testcase_03 AC 53 ms
64,476 KB
testcase_04 AC 68 ms
70,680 KB
testcase_05 AC 59 ms
66,520 KB
testcase_06 AC 58 ms
66,540 KB
testcase_07 AC 58 ms
66,540 KB
testcase_08 AC 56 ms
66,536 KB
testcase_09 AC 66 ms
66,556 KB
testcase_10 AC 66 ms
66,556 KB
testcase_11 AC 57 ms
66,440 KB
testcase_12 AC 69 ms
66,556 KB
testcase_13 AC 72 ms
66,552 KB
testcase_14 AC 74 ms
68,612 KB
testcase_15 AC 84 ms
68,616 KB
testcase_16 AC 79 ms
68,616 KB
testcase_17 AC 74 ms
68,608 KB
testcase_18 AC 86 ms
68,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

t = ni()
for _ in range(t):
    n = ni()
    a = na()
    b = 1
    for j in range(n*2):
        if a[j]-1!=j%n:
            b = 0
            break
    for i in range(n):
        c = 1
        for j in range(n*2):
            #print(1+[j%n, (i+n-j+i)%n][i < j < i+n],end = " ")
            if a[j]!=1+[j%n, (i+n-j+i)%n][i < j < i+n]:
                #print("!")
                c = 0
        
        #print(c)
        if c:
            b = 1
            break
    if b:
        Yes()
    else:
        No()
0