結果
問題 |
No.2518 Adjacent Larger
|
ユーザー |
|
提出日時 | 2023-10-27 22:32:46 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 479 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 81,928 KB |
実行使用メモリ | 103,532 KB |
最終ジャッジ日時 | 2024-09-25 14:35:16 |
合計ジャッジ時間 | 3,743 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 WA * 15 |
ソースコード
from collections import defaultdict import sys input = sys.stdin.readline T = int(input()) for _ in range(T): N = int(input()) A = list(map(int, input().split())) D = defaultdict(int) flag = True for i in range(N): if A[i]==A[(i+1)%N]==0 or A[i]==A[(i+1)%N]==2: flag = False break D[A[i]] += 1 if D[0]==0 or D[2]==0: flag = False if flag: print("Yes") else: print("No")