結果

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
using ll = long long;

int main(void){
  int n; cin >> n;
  vector<int> a(n);
  for(auto&x:a) cin >> x;
  for(int i=0; i<n-1; i++){
    vector<int> b=a;
    swap(b[i], b[i+1]);
    for(int j=0; j<n-1; j++){
      if(b[j]==b[j+1]){
        cout << "Yes" << endl; return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}
0