結果
問題 | No.2518 Adjacent Larger |
ユーザー |
|
提出日時 | 2023-10-28 09:16:16 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 992 bytes |
コンパイル時間 | 192 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 117,376 KB |
最終ジャッジ日時 | 2024-09-25 16:13:04 |
合計ジャッジ時間 | 6,833 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 WA * 14 |
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #alist = [] #s = input() t = int(input()) for _ in range(t): n = int(input()) alist = list(map(int,input().split())) if sum(alist) != n: print('No') continue c = 0 for i in range(n): if alist[i] == 2: if alist[i-1] == 2 or alist[(i+1)%n] == 2: print('No') c = 1 break if alist[i] == 1: if alist[i-1] == 2 and alist[(i+1)%n] == 2: print('No') c = 1 break if alist[i] == 0: if alist[i-1] == 0 or alist[(i+1)%n] == 0: print('No') c = 1 break if alist.count(2) == 0 or alist.count(0) == 0 or alist.count(1) == 0 and c == 0: print('No') c = 1 if not c: print('Yes')