結果

問題 No.1707 Simple Range Reverse Problem
ユーザー とりゐとりゐ
提出日時 2022-05-28 16:39:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 821 ms
コンパイル使用メモリ 81,704 KB
実行使用メモリ 75,480 KB
最終ジャッジ日時 2023-10-20 23:23:20
合計ジャッジ時間 2,667 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,348 KB
testcase_01 AC 51 ms
62,180 KB
testcase_02 AC 46 ms
62,180 KB
testcase_03 AC 50 ms
64,436 KB
testcase_04 AC 48 ms
64,440 KB
testcase_05 AC 44 ms
64,228 KB
testcase_06 AC 43 ms
62,180 KB
testcase_07 AC 44 ms
64,228 KB
testcase_08 AC 42 ms
62,180 KB
testcase_09 AC 52 ms
75,452 KB
testcase_10 AC 52 ms
75,464 KB
testcase_11 AC 40 ms
63,784 KB
testcase_12 AC 55 ms
75,452 KB
testcase_13 AC 60 ms
75,480 KB
testcase_14 AC 59 ms
75,440 KB
testcase_15 AC 67 ms
75,480 KB
testcase_16 AC 61 ms
75,448 KB
testcase_17 AC 58 ms
75,452 KB
testcase_18 AC 64 ms
75,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
  n=int(input())
  a=list(map(int,input().split()))
  b=[i%n+1 for i in range(2*n)]
  if a==b:
    print('Yes')
    return
  for i in range(2*n):
    for j in range(i+1,2*n):
      if b[i]==b[j]:
        c=b[:i+1]+b[j-1:i:-1]+b[j:]
        if a==c:
          print('Yes')
          return
  
  print('No')

for _ in range(int(input())):
  solve()
0