結果

問題 No.1268 Fruit Rush 2
ユーザー tpynerivertpyneriver
提出日時 2020-10-23 23:09:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 296 bytes
コンパイル時間 1,285 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 169,524 KB
最終ジャッジ日時 2023-09-28 17:50:24
合計ジャッジ時間 9,728 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,520 KB
testcase_01 AC 95 ms
71,752 KB
testcase_02 AC 96 ms
71,456 KB
testcase_03 AC 98 ms
71,676 KB
testcase_04 AC 98 ms
71,644 KB
testcase_05 AC 98 ms
71,608 KB
testcase_06 AC 98 ms
71,428 KB
testcase_07 AC 97 ms
71,412 KB
testcase_08 AC 97 ms
71,192 KB
testcase_09 AC 98 ms
71,628 KB
testcase_10 AC 97 ms
71,364 KB
testcase_11 AC 97 ms
71,644 KB
testcase_12 AC 95 ms
71,632 KB
testcase_13 AC 96 ms
71,640 KB
testcase_14 AC 97 ms
71,376 KB
testcase_15 AC 96 ms
71,596 KB
testcase_16 AC 238 ms
147,032 KB
testcase_17 AC 210 ms
141,556 KB
testcase_18 AC 216 ms
145,060 KB
testcase_19 AC 215 ms
144,872 KB
testcase_20 AC 214 ms
145,324 KB
testcase_21 AC 217 ms
144,012 KB
testcase_22 AC 229 ms
149,688 KB
testcase_23 AC 225 ms
144,412 KB
testcase_24 AC 216 ms
144,824 KB
testcase_25 AC 210 ms
141,784 KB
testcase_26 AC 283 ms
143,948 KB
testcase_27 AC 286 ms
140,952 KB
testcase_28 AC 291 ms
142,556 KB
testcase_29 AC 270 ms
143,928 KB
testcase_30 AC 280 ms
142,228 KB
testcase_31 AC 247 ms
168,004 KB
testcase_32 AC 245 ms
168,124 KB
testcase_33 AC 232 ms
168,768 KB
testcase_34 AC 202 ms
169,524 KB
testcase_35 AC 226 ms
168,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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