結果
問題 | No.2343 (l+r)/2 |
ユーザー |
![]() |
提出日時 | 2023-06-09 22:14:12 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 333 ms / 2,000 ms |
コード長 | 593 bytes |
コンパイル時間 | 2,121 ms |
コンパイル使用メモリ | 194,572 KB |
最終ジャッジ日時 | 2025-02-13 23:57:32 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 |
ソースコード
#include <bits/stdc++.h> using namespace std; void solve(){ int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; if (a[0] != a[n-1]){ cout << "Yes" << endl; return ; } for (int i = 0; i < n-1; i++){ if (a[0] != a[i] && a[i] == a[i+1]){ cout << "Yes" << endl; return ; } } int cnt = 0; for (int i = 0; i < n; i++){ if (a[0] != a[i]) cnt++; } cout << (cnt >= 4 ? "Yes" : "No") << endl; } int main(){ int t; cin >> t; while (t--){ solve(); } }