結果
| 問題 |
No.1053 ゲーミング棒
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2020-05-15 23:14:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 964 bytes |
| コンパイル時間 | 1,322 ms |
| コンパイル使用メモリ | 159,560 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 13:20:41 |
| 合計ジャッジ時間 | 2,474 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 WA * 2 |
ソースコード
/**
* @FileName f.cpp
* @Author kanpurin
* @Created 2020.05.15 23:14:45
**/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector< int > a(n);
vector< int > used(n, -1);
bool same = true;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i > 0 && a[0] != a[i]) {
same = false;
}
}
if (same) {
cout << 0 << endl;
return 0;
}
int ok = -1;
for (int i = 1; i < n; i++) {
if (ok == -1 && a[i] != a[0]) {
ok = i;
break;
}
}
for (int i = ok; i < n; i++) {
if (a[i] != a[i-1] && used[a[i]-1] == -1) {
used[a[i]-1] = 0;
}
else if (a[i] != a[i-1]) {
puts("-1");
return 0;
}
}
if (used[a[0]-1] == 0) {
cout << 1 << endl;
}
else {
cout << 0 << endl;
}
return 0;
}
🍮かんプリン