結果
問題 |
No.2518 Adjacent Larger
|
ユーザー |
![]() |
提出日時 | 2023-10-28 01:50:08 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 903 bytes |
コンパイル時間 | 156 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 14,556 KB |
最終ジャッジ日時 | 2024-09-25 15:55:28 |
合計ジャッジ時間 | 4,154 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 23 WA * 5 |
ソースコード
import sys input = sys.stdin.readline """ from itertools import permutations AL=list(permutations(range(6))) for A in AL: A=list(A) S=[0]*len(A) for i in range(len(A)): score=0 for j in [A[i-1],A[(i+1)%len(A)]]: if j>A[i]: score+=1 S[i]=score print(A[:len(A)],S) """ T=int(input()) for tests in range(T): N=int(input()) A=list(map(int,input().split())) if A==[1]*N: print("No") continue flag=1 for i in range(N): if A[i]==2 and A[i-1]==2: flag=0 if A[i]==0 and A[i-1]==0: flag=0 if A[i]==1: if A[i-1]==A[(i+1)%N]==2: flag=0 if A[i-1]==A[(i+1)%N]==0: flag=0 if flag==0: print("No") continue if sum(A)==N: print("Yes") else: print("No")