結果
| 問題 |
No.1707 Simple Range Reverse Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-15 21:32:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 836 bytes |
| コンパイル時間 | 1,262 ms |
| コンパイル使用メモリ | 166,160 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-07-13 03:50:40 |
| 合計ジャッジ時間 | 1,955 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
using namespace std;
typedef long long ll;
int main() {
int T;
cin >> T;
while (T-- > 0) {
int N;
cin >> N;
vector<int> X(2 * N), A(2 * N);
rep(i, 0, 2 * N) X[i] = i % N + 1;
rep(i, 0, 2 * N) cin >> A[i];
string ans = "No\n";
bool f = true;
rep(j, 0, 2 * N) f = f && (X[j] == A[j]);
if (f) ans = "Yes\n";
rep(i, 0, N) {
rep(j, 0, (N + 1) / 2) swap(X[i + j], X[N + i - j]);
f = true;
//rep(j, 0, 2 * N) cout << X[j] << " "; cout << endl;
rep(j, 0, 2 * N) f = f && (X[j] == A[j]);
if (f) ans = "Yes\n";
rep(j, 0, (N + 1) / 2) swap(X[i + j], X[N + i - j]);
}
cout << ans;
}
}