結果

問題 No.182 新規性の虜
ユーザー excnct
提出日時 2025-01-02 00:14:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 20,120 KB
最終ジャッジ日時 2025-01-02 00:14:31
合計ジャッジ時間 3,156 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 12 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n = int(input())
    a = [int(i) for i in input().split(" ")]
    sorted_a = sorted(a)
    count = 0
    if n == 1:
        print(1)
        return
    elif n == 2:
        if sorted_a[0] != sorted_a[1]:
            print(2)
            return
        else:
            return

    else:
        for i in range(1, n - 1):
            if sorted_a[i] != sorted_a[i + 1] and sorted_a[i] != sorted_a[i - 1]:
                count += 1

        if sorted_a[0] != sorted_a[1] or sorted_a[n - 2] != sorted_a[n - 1]:
            count += 1

    print(count)


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