結果

問題 No.1707 Simple Range Reverse Problem
ユーザー V_MelvilleV_Melville
提出日時 2021-10-15 22:09:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 409 bytes
コンパイル時間 2,053 ms
コンパイル使用メモリ 199,748 KB
最終ジャッジ日時 2025-01-25 00:51:44
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 7 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::map;

int main() {
	int t;
	cin >> t;
	
	while (t--) {
		int n;
		cin >> n;
		n *= 2;
		bool ok = true;
		map<int, int> mp;
		rep(i, n) {
			int a; cin >> a;
			if (mp.count(a) and (i - mp[a] <= 1 or i - mp[a] >= n)) ok = false;
			mp[a] = i;
		}
		puts(ok ? "Yes" : "No");
	}
	
	return 0;
}
0