結果
| 問題 |
No.2518 Adjacent Larger
|
| コンテスト | |
| ユーザー |
H20
|
| 提出日時 | 2023-10-27 22:49:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 414 bytes |
| コンパイル時間 | 371 ms |
| コンパイル使用メモリ | 82,444 KB |
| 実行使用メモリ | 104,064 KB |
| 最終ジャッジ日時 | 2024-09-25 14:51:37 |
| 合計ジャッジ時間 | 4,516 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 17 WA * 11 |
ソースコード
import collections
T = int(input())
for _ in range(T):
N = int(input())
A = list(map(int, input().split()))
C = collections.Counter(A)
ans = C[0]==C[2] and C[1]<N
temp = 0
for i in range(N):
if A[i]==A[i-1] and A[i]!=1:
ans = False
temp+=A[i]-1
if temp<-1 or 1<temp:
ans = False
if ans:
print('Yes')
else:
print('No')
H20