結果
| 問題 |
No.1053 ゲーミング棒
|
| コンテスト | |
| ユーザー |
QCFium
|
| 提出日時 | 2020-04-18 16:22:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 543 bytes |
| コンパイル時間 | 1,407 ms |
| コンパイル使用メモリ | 167,748 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-09-19 09:11:43 |
| 合計ジャッジ時間 | 5,318 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 TLE * 1 -- * 10 |
ソースコード
#include <bits/stdc++.h>
int ri() {
int n;
scanf("%d", &n);
return n;
}
// should be TLE
int main() {
int n = ri();
int a[n];
for (auto &i : a) i = ri() - 1;
int res = -1;
for (int i = 0; i < n; i++) {
int used[n];
memset(used, 0, sizeof(used));
bool ok = true;
for (int j = 0; j < n; j++) {
if (j && a[j] == a[j - 1]) continue;
if (used[a[j]]) {
ok = false;
break;
}
used[a[j]] = true;
}
if (ok) {
res = !!i;
break;
}
std::rotate(a, a + 1, a + n);
}
printf("%d\n", res);
return 0;
}
QCFium