結果

問題 No.1053 ゲーミング棒
ユーザー tamatotamato
提出日時 2020-05-15 21:47:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 87,680 KB
最終ジャッジ日時 2024-09-19 09:19:25
合計ジャッジ時間 2,886 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))

    AA = []
    prev = -1
    for a in A:
        if a != prev:
            AA.append(a)
        prev = a
    seen = [0] * (N+1)
    for i in range(len(AA)-1):
        a = AA[i]
        if seen[a]:
            print(-1)
            exit()
        seen[a] = 1
    if seen[AA[-1]]:
        print(1)
    else:
        print(0)


if __name__ == '__main__':
    main()
0