結果

問題 No.1285 ゴミ捨て
コンテスト
ユーザー toshiro_yanagi
提出日時 2022-07-03 23:01:52
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 561 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 60 ms
コンパイル使用メモリ 14,848 KB
実行使用メモリ 15,480 KB
最終ジャッジ日時 2026-10-02 06:02:20
合計ジャッジ時間 4,705 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 1 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

bufio_scanner = []


def main():
    n = int(fmt_scan())
    a = [int(fmt_scan()) for _ in range(n)]

    a.sort()
    ans = n
    k = 0
    for i in range(n):
        if i == 0:
            continue
        for k in range(2):
            try:
                if a[i - 1 - k] + 1 < a[i]:
                    ans -= 1
            except:
                pass
    print(ans)


def fmt_scan() -> str:
    sc = bufio_scanner
    if len(sc) == 0:
        for v in input().split()[::-1]:
            sc.append(v)
    res = sc[-1]
    sc.pop()
    return res


main()
0