結果

問題 No.1268 Fruit Rush 2
コンテスト
ユーザー tpyneriver
提出日時 2020-10-23 23:09:40
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 190 ms / 2,000 ms
+ 429µs
コード長 296 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 245 ms
コンパイル使用メモリ 96,092 KB
実行使用メモリ 181,540 KB
最終ジャッジ日時 2026-08-21 17:53:24
合計ジャッジ時間 7,687 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
readline = sys.stdin.readline
from collections import Counter


N = int(readline())
A = list(map(int, readline().split()))
A.sort()
SA = set(A)
table = Counter()
ans = len(A)
for a in A:
    if a-1 in SA:
        table[a] += 1
    table[a+2] += table[a]
    ans += table[a]

print(ans)
0