結果

問題 No.2343 (l+r)/2
ユーザー LeoPro
提出日時 2023-06-09 21:25:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 1,823 ms
コンパイル使用メモリ 198,176 KB
最終ジャッジ日時 2025-02-13 23:47:17
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define int long long

using namespace std;
using ll = long long;

void solve();

template<typename ...Args>
void println(Args... args) {
    apply([](auto &&... args) { ((cout << args << ' '), ...); }, tuple(args...));
    cout << '\n';
}

int32_t main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int t = 1;
    cin >> t;
    for (int tc = 0; tc < t; ++tc) {
        solve();
    }
    return 0;
}
void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int &x : a) cin >> x;
    if (a.front() != a.back()) return println("Yes");
    auto b = a;
    b.erase(unique(b.begin(), b.end()), b.end());
    if (b.size() >= 9) return println("Yes");
    int x = a.front();
    for (int i = 0; i + 1 < n; ++i) if (a[i] != x && a[i + 1] != x) return println("Yes");
    println("No");
}
0