結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <numeric>
using namespace std;
using ll = long long;
int main() {
	int N;cin >> N;
	vector<int> A(N);
	for (int i = 0;i < N;i++) cin >> A[i];
	for (int i = 0;i < N-1;i++) {
		vector<int> B = A;
		swap(B[i], B[i+1]);
		int c = 0;
		for (int t = 0;t < N-1;t++) if (B[t] == B[t+1]) c++;
		if (c >= 1) {
			cout <<"Yes" << endl;
			return 0;
		}
	}
	cout <<"No" << endl;
}
0