結果

問題 No.2343 (l+r)/2
ユーザー CyanmondCyanmond
提出日時 2023-06-09 21:16:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 3,624 ms
コンパイル使用メモリ 199,184 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-30 12:46:52
合計ジャッジ時間 3,455 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;
            }
        }
        std::cout << (isOk ? "Yes" : "No") << std::endl;
    } else {
        std::cout << "Yes" << std::endl;
    }
}

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