結果
| 問題 |
No.2518 Adjacent Larger
|
| コンテスト | |
| ユーザー |
FromBooska
|
| 提出日時 | 2023-10-27 22:04:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 908 bytes |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 82,580 KB |
| 実行使用メモリ | 101,836 KB |
| 最終ジャッジ日時 | 2024-09-25 14:10:21 |
| 合計ジャッジ時間 | 4,246 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 WA * 14 |
ソースコード
# 実験してみると
# 和がNであり、0が常に1つ以上あり、マックスが2である必要ある
# さらに2は連続できない、0も連続できない
T = int(input())
for t in range(T):
N = int(input())
A = list(map(int, input().split()))
zero_test = False
max_test = True
sum_test = False
if sum(A)==N:
sum_test = True
for a in A:
if a == 0:
zero_test = True
if a > 2:
max_test = False
zero_consec_test = True
two_consec_test = True
for i in range(N):
if A[(i-1)%N]==2 and A[i]==2:
two_consec_test = False
if A[(i-1)%N]==0 and A[i]==0:
zero_consec_test = False
ans = 'No'
if sum_test == True and zero_test == True and max_test == True:
if zero_consec_test == True and two_consec_test == True:
ans = 'Yes'
print(ans)
FromBooska