結果

問題 No.2343 (l+r)/2
ユーザー lingfunnylingfunny
提出日時 2023-06-09 23:20:20
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 745 bytes
コンパイル時間 2,981 ms
コンパイル使用メモリ 248,400 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 14:31:00
合計ジャッジ時間 4,084 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 54 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 9 ms
4,376 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 4 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 10 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 12 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using ll = long long;
using uint = unsigned;
using namespace std;

const int mxn = 2e5 + 10;

int TestCase, f[mxn][3];

signed main() {
	for (scanf("%d", &TestCase); TestCase--;) {
		int n;
		scanf("%d", &n);
		vector<int> a(n);
		for (int &x : a) scanf("%d", &x);
		vector<bool> tag;
		int last = a[0], len = 0;
		a.push_back(-1);
		for (int i = 0; i <= n; ++i) {
			if (a[i] == last) ++len;
			else {
				tag.push_back(len > 1);
				last = a[i], len = 1;
			}
		}
		auto solve = [&]() {
			// printf("size = %d\n", (int)tag.size());
			if (tag.size() % 2 == 0) return puts("Yes");
			for (int i = 1; i < (int)tag.size(); i += 2)
				if (tag[i]) return puts("Yes");
			return puts("No");
		};
		solve();
	}
	return 0;
}
0