結果
| 問題 |
No.2518 Adjacent Larger
|
| コンテスト | |
| ユーザー |
nono00
|
| 提出日時 | 2023-10-28 05:34:49 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 922 bytes |
| コンパイル時間 | 2,882 ms |
| コンパイル使用メモリ | 254,140 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 16:04:57 |
| 合計ジャッジ時間 | 4,195 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
namespace nono {
struct Init {};
void solve([[maybe_unused]] const Init& init) {
int n;
std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++) std::cin >> a[i];
if (std::ranges::find(a, 0) == a.end()) {
std::cout << "No" << std::endl;
return;
}
if (std::ranges::find(a, 2) == a.end()) {
std::cout << "No" << std::endl;
return;
}
std::erase_if(a, [](int v) { return v == 1; });
int m = a.size();
for (int i = 0; i < m; i++) {
if (a[i] == a[(i + 1) % m]) {
std::cout << "No" << std::endl;
return;
}
}
std::cout << "Yes" << std::endl;
}
} // namespace nono
int main() {
std::cin.tie(0)->sync_with_stdio(0);
std::cout << std::fixed << std::setprecision(16);
int t = 1;
nono::Init init;
std::cin >> t;
while (t--) nono::solve(init);
}
nono00