結果
問題 | No.1707 Simple Range Reverse Problem |
ユーザー |
![]() |
提出日時 | 2021-10-15 22:35:10 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 653 bytes |
コンパイル時間 | 228 ms |
コンパイル使用メモリ | 82,428 KB |
実行使用メモリ | 81,192 KB |
最終ジャッジ日時 | 2024-09-17 17:45:10 |
合計ジャッジ時間 | 2,595 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 6 WA * 12 |
ソースコード
import sysinput = sys.stdin.readlinefrom pprint import pprintimport mathINF = 1 << 63def do():n = int(input())l = list(map(int, input().split()))if l[0] != 1:print("No")returnif l[-1] != n:print("No")returnfor i in range(n):if l[i+1] == (i+1)%n + 1: continue#print("hit", i, l[i])ll, rr = i, -1t = l[i]for i in range(ll+1, 2*n):if l[i] == t:rr = ibreakl = l[:ll] + list(reversed(l[ll:rr + 1])) + l[rr+1:]print("Yes")# n questionsq = int(input())for _ in range(q):do()