結果
| 問題 |
No.2490 Escalator
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-29 20:14:22 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 959 bytes |
| コンパイル時間 | 1,672 ms |
| コンパイル使用メモリ | 196,144 KB |
| 最終ジャッジ日時 | 2025-02-17 03:00:07 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 TLE * 1 -- * 51 |
ソースコード
#include <bits/stdc++.h>
bool solve(std::vector<int> A) {
const int N = (int)A.size() / 2;
bool ans = false;
for (int s = 0; s < 2 * N; ++s) {
for (int t = 0; t < 2 * N; ++t) {
std::vector<int> x, y;
int i = s;
while ((int)x.size() < N) {
x.push_back(A[i]);
i = (i + 1) % (2 * N);
}
i = t;
while ((int)y.size() < N) {
y.push_back(A[i]);
i = (i - 1 + 2 * N) % (2 * N);
}
bool mans = true;
for (int i = 0; i < N; ++i) {
if (x[i] != -1 and y[i] != -1 and x[i] != y[i]) mans = false;
}
ans |= mans;
}
}
return ans;
}
int main() {
int N;
std::cin >> N;
std::vector<int> A(2 * N);
for (auto &e : A) std::cin >> e;
const auto res = solve(A);
std::cout << (res ? "Yes" : "No") << std::endl;
}