結果

問題 No.2343 (l+r)/2
ユーザー 苏璃cx
提出日時 2023-06-09 22:06:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 1,495 ms
コンパイル使用メモリ 156,400 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-02 03:11:20
合計ジャッジ時間 2,835 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 4 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

void solve(){
	int n;
	cin >> n;
	int a[n];
	int res = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		res++;
	}
	for(int i = 0; i < n; i++){
		if(a[i] == 0 && a[i-1] == 0 && a[i+1] == 0){
			n--;
		}
		if(a[i] == 1 && a[i-1] == 1 && a[i+1] == 1){
			n--;
			res--;
		}
	}
	if(res * 2 == n){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}

int main(){
	int T;
	cin >> T;
	while(T--) {
	    solve();
	}
	return 0;
}
0