結果

問題 No.3286 Make a Happy Connection
ユーザー ゼリトキ
提出日時 2025-10-03 22:26:45
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 2,973 ms
コンパイル使用メモリ 275,900 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-03 22:26:50
合計ジャッジ時間 4,547 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long mod=998244353;
const long long mod100=1000000007;
int main(){
    cin.tie(0)->sync_with_stdio(0);
    cout.tie(0);
    int N;
    cin>>N;
    int A[N+2];
    for(int i=1;i<=N;i++) cin>>A[i];
    A[0]=-1;
    A[N+1]=-1;
    for(int i=1;i<N;i++){
        swap(A[i],A[i+1]);
        if(A[i]==A[i-1] || A[i]==A[i+1] || A[i+1]==A[i+2]){
            cout<<"Yes\n";
            return 0;
        }
        swap(A[i],A[i+1]);
    }
    cout<<"No\n";
}
0