結果

問題 No.2343 (l+r)/2
ユーザー LeoProLeoPro
提出日時 2023-06-09 21:25:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 2,211 ms
コンパイル使用メモリ 204,364 KB
実行使用メモリ 5,160 KB
最終ジャッジ日時 2023-08-30 12:52:20
合計ジャッジ時間 3,236 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 45 ms
4,384 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 17 ms
4,380 KB
testcase_04 AC 8 ms
4,476 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 7 ms
4,380 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 AC 7 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 9 ms
4,764 KB
testcase_12 AC 7 ms
4,384 KB
testcase_13 AC 6 ms
4,384 KB
testcase_14 AC 11 ms
5,160 KB
権限があれば一括ダウンロードができます

ソースコード

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