結果
問題 | No.1707 Simple Range Reverse Problem |
ユーザー | kuro_B |
提出日時 | 2023-05-18 18:05:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 287 ms / 2,000 ms |
コード長 | 1,664 bytes |
コンパイル時間 | 2,025 ms |
コンパイル使用メモリ | 86,936 KB |
実行使用メモリ | 96,208 KB |
最終ジャッジ日時 | 2023-08-22 11:17:38 |
合計ジャッジ時間 | 7,886 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 262 ms
95,152 KB |
testcase_01 | AC | 270 ms
95,888 KB |
testcase_02 | AC | 273 ms
95,648 KB |
testcase_03 | AC | 277 ms
95,752 KB |
testcase_04 | AC | 267 ms
95,540 KB |
testcase_05 | AC | 275 ms
95,884 KB |
testcase_06 | AC | 273 ms
95,980 KB |
testcase_07 | AC | 266 ms
95,764 KB |
testcase_08 | AC | 276 ms
96,208 KB |
testcase_09 | AC | 282 ms
95,772 KB |
testcase_10 | AC | 277 ms
95,868 KB |
testcase_11 | AC | 268 ms
95,628 KB |
testcase_12 | AC | 279 ms
95,892 KB |
testcase_13 | AC | 283 ms
95,896 KB |
testcase_14 | AC | 287 ms
95,744 KB |
testcase_15 | AC | 287 ms
95,680 KB |
testcase_16 | AC | 287 ms
96,100 KB |
testcase_17 | AC | 276 ms
95,744 KB |
testcase_18 | AC | 283 ms
96,092 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')