結果

問題 No.2343 (l+r)/2
ユーザー rabimea
提出日時 2025-09-29 15:00:12
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 832 bytes
コンパイル時間 2,793 ms
コンパイル使用メモリ 278,168 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-29 15:00:17
合計ジャッジ時間 4,918 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 7 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC optimize ("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target ("avx,avx2,fma")
#include <bits/stdc++.h>

using std::cin, std::cout, std::cerr;
using ll = long long;

int main() {
    std::ios::sync_with_stdio(false);
    int T; cin >> T;
    while(T --) {
        int n; cin >> n;
        std::vector<int> a(n);
        int x = 0, y = 0, cx = 0, cy = 0;
        for(int i = 0; i < n; i ++) {
            cin >> a[i];
            if(a[i] == 0) x ++;
            else y ++;
            if(i > 0 && a[i] == a[i - 1]) {
                if(a[i] == 0) cx ++;
                else cy ++;
            }
        }

        if(x > y) {
            std::swap(x, y);
            std::swap(cx, cy);
        }
        if(y - cy <= x)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
}
0