結果

問題 No.2343 (l+r)/2
ユーザー shobonvip
提出日時 2023-06-10 03:07:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 943 bytes
コンパイル時間 3,661 ms
コンパイル使用メモリ 253,596 KB
最終ジャッジ日時 2025-02-14 01:15:05
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef modint998244353 mint;
typedef long long ll;

void dfs(int n, vector<double> v){
	if (n == 1){
		if (abs(v[0] - 0.5) < 0.001) cout << v[0] << endl;
		return;
	}

	for (int i=0; i<n-1; i++){
		vector<double> tmp;
		for (int j=0; j<i; j++){
			tmp.push_back(v[j]);
		}
		tmp.push_back((v[i] + v[i+1]) / 2);
		for (int j=i+2; j<n; j++){
			tmp.push_back(v[j]);
		}
		dfs(n-1, tmp);
	}
}

void solve(){
	int n; cin >> n;
	vector<int> a(n);
	for (int i=0; i<n; i++){
		cin >> a[i];
	}
	int mode = 0;
	for (int i=0; i<n; i++){
		mode |= 1 << a[i];
	}
	if (mode != 3){
		cout << "No\n";
		return;
	}
	for (int i=0; i<n-1; i++){
		if (a[i] == a[i+1]){
			cout << "Yes\n";
			return;
		}
	}
	if (n % 2 == 0){
		cout << "Yes\n";
	}else if (n <= 7){
		cout << "No\n";
	}else{
		cout << "Yes\n";
	}
}

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