結果

問題 No.2518 Adjacent Larger
ユーザー achapi
提出日時 2023-10-27 22:20:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 1,878 ms
コンパイル使用メモリ 195,812 KB
最終ジャッジ日時 2025-02-17 15:14:52
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	int T;
	cin >> T;
	while (T--){
		int N;
		cin >> N;
		vector<int> A(N);
		for (int i = 0; i < N; i++){
			cin >> A[i];
		}
		bool ok = true;
		for (int i = 0; i < N; i++){
			if (A[i] == 0 and A[(i + 1) % N] == 0){
				ok = false;
			}
			if (A[i] == 2 and A[(i + 1) % N] == 2){
				ok = false;
			}
		}
		if (A == vector<int>(N, 1)){
			ok = false;
		}
		if (ok){
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
}
0