結果
問題 |
No.2343 (l+r)/2
|
ユーザー |
|
提出日時 | 2023-06-09 21:29:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 793 bytes |
コンパイル時間 | 1,660 ms |
コンパイル使用メモリ | 195,480 KB |
最終ジャッジ日時 | 2025-02-13 23:48:01 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 WA * 7 |
ソースコード
#include <bits/stdc++.h> using i64 = long long; void solve() { int N; std::cin >> N; std::vector<int> A(N); for (auto &e : A) std::cin >> e; if (A[0] == 1) { for (auto &e : A) e = 1 - e; } if (A[N - 1] == 0) { bool isOk = false; for (int i = 0; i < N - 1; ++i) { if (A[i] == 1 and A[i + 1] == 1) { isOk = true; } } int s = 1; for (int i = 1; i < N; ++i) { if (A[i] != A[i - 1]) { ++s; } } if (s >= 7 and s % 4 == 3) isOk = true; std::cout << (isOk ? "Yes" : "No") << std::endl; } else { std::cout << "Yes" << std::endl; } } int main() { int T; std::cin >> T; while (T--) solve(); }