結果
問題 | No.1369 交換門松列・竹 |
ユーザー | GER_chen |
提出日時 | 2021-01-29 22:37:35 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,429 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 82,044 KB |
実行使用メモリ | 81,072 KB |
最終ジャッジ日時 | 2024-06-27 08:57:32 |
合計ジャッジ時間 | 5,368 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
65,188 KB |
testcase_01 | WA | - |
testcase_02 | AC | 46 ms
62,144 KB |
testcase_03 | AC | 47 ms
61,216 KB |
testcase_04 | AC | 47 ms
62,268 KB |
testcase_05 | AC | 47 ms
62,740 KB |
testcase_06 | AC | 49 ms
62,308 KB |
testcase_07 | AC | 38 ms
53,324 KB |
testcase_08 | AC | 38 ms
53,972 KB |
testcase_09 | AC | 37 ms
53,492 KB |
testcase_10 | AC | 38 ms
52,956 KB |
testcase_11 | AC | 38 ms
54,228 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
ソースコード
#1369 #import sys;input = lambda: sys.stdin.readline().rstrip() #import heapq #from collections import deque #import numpy as np #from collections import Counter as cnt #from collections import defaultdict as ddc #from math import factorial as fct #from math import gcd #from bisect import bisect_left as bsl #from bisect import bisect_right as bsr #from itertools import accumulate as acc #from itertools import combinations as cmb #from itertools import permutations as pmt #from itertools import product as prd #from functools import reduce as red #import sys #sys.setrecursionlimit(10**9) #再帰を多く使う(デフォルトは1000) def kadomatsu(L): """kadomatsuならTrueを返す""" if len(set(L)) == 3 and L[1] in {min(L), max(L)}: return True return False for _ in range(int(input())): n = int(input()) A = list(map(int,input().split())) Sub = [A[i:i+3] for i in range(n-2)] Nk, ct, bct, B, b = [], 0, 0, [], 0 #bが0ならイエス、1ならノー for i, S in enumerate(Sub): if not kadomatsu(S): if Nk == []: ct += 1 bct = i B.append(i) else: if bct+2 < i: ct += 1 bct = i B.append(i) if ct > 2: b = 1 break Nk.append(i) if ct == 1: b0 = B[0] b = 1 for i in range(min(3, n-b0)): for j in range(n): if A[b0+i] != A[j]: X = [a for a in A] X[b0+i], X[j] = X[j], X[b0+i] if all([kadomatsu(X[b0+i+k:b0+i+k+3]) for k in range(max(-2, -b0-i), min(3, n-3-b0-i))]): if all([kadomatsu(X[j+k:j+k+3]) for k in range(max(-2, -j), min(3, n-3-j))]): b = 0 pass if ct == 2: b0, b1 = B b = 1 for i in range(3): for j in range(min(3, n-b1)): if A[b0+i] != A[b1+j]: X = [a for a in A] X[b0+i], X[b1+j] = X[b1+j], X[b0+i] if all([kadomatsu(X[b0+i+k:b0+i+k+3]) for k in range(max(-2, -b0-i), min(3, n-3-b0-i))]): if all([kadomatsu(X[b1+j+k:b1+j+k+3]) for k in range(max(-2, -b1-j), min(3, n-3-b1-j))]): b = 0 print('YNeos'[b::2])