結果

問題 No.1053 ゲーミング棒
ユーザー onsen_manjuuuonsen_manjuuu
提出日時 2020-05-15 21:57:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 1,689 ms
コンパイル使用メモリ 175,836 KB
実行使用メモリ 8,336 KB
最終ジャッジ日時 2023-10-19 14:11:03
合計ジャッジ時間 3,392 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 69 ms
8,336 KB
testcase_24 AC 78 ms
8,336 KB
testcase_25 AC 78 ms
8,336 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
4,348 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 17 ms
4,348 KB
testcase_34 AC 17 ms
4,348 KB
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;


int main()
{
    int n; cin >> n;vector<int> a(n); for(int i = 0; i < n; i++)cin >> a[i];
    a.resize(unique(a.begin(), a.end()) - a.begin());

    set<int> st;
    for(int i = 1; i < n - 1; i++) {
        if(st.count(a[i])) {
            cout << -1 << endl;
            return 0;
        } else {
            st.insert(a[i]);
        }
    }

    if(a.front() == a.back()) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}
0