結果

問題 No.3286 Make a Happy Connection
ユーザー KonanKarasawa
提出日時 2025-10-22 20:11:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 652 bytes
コンパイル時間 1,783 ms
コンパイル使用メモリ 195,512 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-22 20:11:05
合計ジャッジ時間 3,042 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N,X=0;
    cin >>N;
    int array[N];
    for(int i=0;i<N;i++){
    	int A=0;
    	cin>>A;
    	array[i]=A;
    	  }
    	  
    for(int i=0;i<(N-1);i++){
      if (array[i]==array[i+1]){
        X+=1;
      }
      if(i==(N-1)){
         if(X>0){
    	    cout<<"Yes"<<endl;
    	  }
    	  else{
    	    cout<<"No"<<endl;
    	  }
        
      }
    }
    for(int i=0;i<=(N-2);i++){
     if(array[i]==array[i+2]){
    	  X+=1;
    	}
    	
    	if(i==(N-2)){
    	  if(X>0){
    	    cout<<"Yes"<<endl;
    	  }
    	  else{
    	    cout<<"No"<<endl;
    	  }
    	}
    }
    }
0