結果
問題 |
No.3286 Make a Happy Connection
|
ユーザー |
|
提出日時 | 2025-10-03 22:51:47 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 551 bytes |
コンパイル時間 | 3,099 ms |
コンパイル使用メモリ | 278,052 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-10-03 22:51:52 |
合計ジャッジ時間 | 4,459 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> [[nodiscard]] static inline constexpr const char* solve(const uint_fast32_t N, const std::vector<uint_least32_t>& A) noexcept { for (uint_fast32_t i = 1; i < N; ++i) if (A[i] == A[i - 1]) return "Yes"; for (uint_fast32_t i = 2; i < N; ++i) if (A[i] == A[i - 2]) return "Yes"; return "No"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); uint_fast32_t N; std::cin >> N; std::vector<uint_least32_t> A(N); for (auto& a : A) std::cin >> a; std::cout << solve(N, A) << '\n'; return 0; }