結果
問題 | No.1369 交換門松列・竹 |
ユーザー | titia |
提出日時 | 2021-01-29 22:15:26 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,063 bytes |
コンパイル時間 | 104 ms |
コンパイル使用メモリ | 11,052 KB |
実行使用メモリ | 18,544 KB |
最終ジャッジ日時 | 2023-09-09 15:41:35 |
合計ジャッジ時間 | 18,707 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 16 ms
8,252 KB |
testcase_03 | AC | 16 ms
8,208 KB |
testcase_04 | AC | 15 ms
8,216 KB |
testcase_05 | AC | 15 ms
7,804 KB |
testcase_06 | AC | 15 ms
8,252 KB |
testcase_07 | WA | - |
testcase_08 | AC | 15 ms
8,180 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 15 ms
8,192 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 306 ms
14,148 KB |
testcase_16 | AC | 385 ms
14,156 KB |
testcase_17 | AC | 424 ms
14,128 KB |
testcase_18 | AC | 389 ms
13,972 KB |
testcase_19 | AC | 294 ms
14,028 KB |
testcase_20 | WA | - |
testcase_21 | AC | 265 ms
14,180 KB |
testcase_22 | WA | - |
testcase_23 | AC | 358 ms
13,992 KB |
testcase_24 | TLE | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | TLE | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | AC | 61 ms
8,124 KB |
testcase_33 | AC | 364 ms
8,932 KB |
ソースコード
def kado(x,y,z): if x==z: return 0 if y<x and y<z: return 1 if y>x and y>z: return 1 return 0 T=int(input()) for tests in range(T): N=int(input()) A=list(map(int,input().split())) NO=[] for i in range(1,N-1): if kado(A[i-1],A[i],A[i+1])==0: NO.extend([i-1,i,i+1]) NO=sorted(set(NO)) flag=0 if len(NO)<=50: for x in NO: if flag==1: break for i in range(N): if flag==1: break if x==i: continue A[x],A[i]=A[i],A[x] for a in NO+list(range(i-2,i+3)): if a<=0 or a>=N-1: continue if kado(A[a-1],A[a],A[a+1])==0: break else: print("Yes") flag=1 break A[x],A[i]=A[i],A[x] if flag==0: print("NO")