結果
問題 | No.1707 Simple Range Reverse Problem |
ユーザー | kuro_B |
提出日時 | 2023-05-18 18:05:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 165 ms / 2,000 ms |
コード長 | 1,664 bytes |
コンパイル時間 | 413 ms |
コンパイル使用メモリ | 82,260 KB |
実行使用メモリ | 83,364 KB |
最終ジャッジ日時 | 2024-05-09 16:57:22 |
合計ジャッジ時間 | 4,651 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 142 ms
82,560 KB |
testcase_01 | AC | 144 ms
83,200 KB |
testcase_02 | AC | 141 ms
83,072 KB |
testcase_03 | AC | 144 ms
83,072 KB |
testcase_04 | AC | 146 ms
83,200 KB |
testcase_05 | AC | 144 ms
83,008 KB |
testcase_06 | AC | 147 ms
82,944 KB |
testcase_07 | AC | 144 ms
83,260 KB |
testcase_08 | AC | 148 ms
83,328 KB |
testcase_09 | AC | 151 ms
83,328 KB |
testcase_10 | AC | 150 ms
83,276 KB |
testcase_11 | AC | 142 ms
83,028 KB |
testcase_12 | AC | 155 ms
83,200 KB |
testcase_13 | AC | 158 ms
83,364 KB |
testcase_14 | AC | 164 ms
83,324 KB |
testcase_15 | AC | 165 ms
83,168 KB |
testcase_16 | AC | 162 ms
83,224 KB |
testcase_17 | AC | 158 ms
83,328 KB |
testcase_18 | AC | 160 ms
83,200 KB |
ソースコード
###スニペット始まり### import sys, re from copy import copy, deepcopy from math import ceil, floor, sqrt,factorial, gcd, pi, degrees, radians, sin, asin, cos, acos, tan, atan2 from statistics import mean, median from collections import Counter, deque, defaultdict from heapq import heapify, heappop, heappush from itertools import permutations, accumulate, product, combinations, combinations_with_replacement from bisect import bisect, bisect_left, bisect_right from functools import reduce, lru_cache from string import ascii_uppercase, ascii_lowercase from decimal import Decimal, ROUND_HALF_UP #四捨五入用 def input(): return sys.stdin.readline().rstrip('\n') #easy-testのpypyでは再帰数を下げる。 if __file__=='prog.py': sys.setrecursionlimit(10**5) else: sys.setrecursionlimit(10**6) def lcm(a, b): return a * b // gcd(a, b) #3つ以上の最大公約数/最小公倍数。Nを要素数、Mを数値の大きさとして、O(NlogM) def gcd_v2(l: list): return reduce(gcd, l) def lcm_v2(l: list): return reduce(lcm, l) #nPk def nPk(n, k): return factorial(n) // factorial(n - k) #逆元 def modinv(a, mod=10**9+7): return pow(a, mod-2, mod) INF = float('inf') MOD = 10 ** 9 + 7 ###スニペット終わり### T=int(input()) for _ in range(T): N=int(input()) A=list(map(int, input().split())) B=[] for i in range(2*N): B.append(i%N+1) flag=False if A==B: flag=True else: for i in range(N): C=B[:i]+B[i:i+N+1][::-1]+B[i+N+1:] if A==C: flag=True break if flag: print('Yes') else: print('No')