結果

問題 No.1268 Fruit Rush 2
ユーザー ああいいああいい
提出日時 2022-03-16 22:53:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 241 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 171,108 KB
最終ジャッジ日時 2023-10-25 06:30:00
合計ジャッジ時間 8,118 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,556 KB
testcase_01 AC 42 ms
53,556 KB
testcase_02 AC 41 ms
53,556 KB
testcase_03 AC 41 ms
53,556 KB
testcase_04 AC 42 ms
53,556 KB
testcase_05 AC 42 ms
53,556 KB
testcase_06 AC 42 ms
53,556 KB
testcase_07 AC 41 ms
53,556 KB
testcase_08 AC 42 ms
53,556 KB
testcase_09 AC 42 ms
53,556 KB
testcase_10 AC 42 ms
53,556 KB
testcase_11 AC 41 ms
53,556 KB
testcase_12 AC 41 ms
53,556 KB
testcase_13 AC 42 ms
53,556 KB
testcase_14 AC 42 ms
53,556 KB
testcase_15 AC 41 ms
53,556 KB
testcase_16 AC 161 ms
118,860 KB
testcase_17 AC 146 ms
119,808 KB
testcase_18 AC 151 ms
120,412 KB
testcase_19 AC 150 ms
120,192 KB
testcase_20 AC 146 ms
120,408 KB
testcase_21 AC 149 ms
119,580 KB
testcase_22 AC 158 ms
118,620 KB
testcase_23 AC 156 ms
118,356 KB
testcase_24 AC 150 ms
120,456 KB
testcase_25 AC 150 ms
119,856 KB
testcase_26 AC 239 ms
165,796 KB
testcase_27 AC 239 ms
165,616 KB
testcase_28 AC 238 ms
165,632 KB
testcase_29 AC 241 ms
165,604 KB
testcase_30 AC 239 ms
165,608 KB
testcase_31 AC 170 ms
109,560 KB
testcase_32 AC 171 ms
109,408 KB
testcase_33 AC 154 ms
136,872 KB
testcase_34 AC 159 ms
143,856 KB
testcase_35 AC 175 ms
171,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
A.sort()
from collections  import defaultdict
d = defaultdict(int)
for a in A:
    d[a] += 1
for a in reversed(A):
    if a - 2 in d:
        d[a-2] += d[a]
ans = 0
for a in A:
    ans += 1 + d[a+1]
print(ans)
0