結果

問題 No.1268 Fruit Rush 2
ユーザー mlihua09mlihua09
提出日時 2020-10-23 23:41:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 363 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,340 KB
実行使用メモリ 176,040 KB
最終ジャッジ日時 2023-09-28 19:00:10
合計ジャッジ時間 8,829 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,860 KB
testcase_01 AC 97 ms
71,580 KB
testcase_02 AC 101 ms
71,824 KB
testcase_03 AC 96 ms
71,816 KB
testcase_04 AC 97 ms
71,860 KB
testcase_05 AC 96 ms
71,852 KB
testcase_06 AC 95 ms
71,612 KB
testcase_07 AC 100 ms
71,548 KB
testcase_08 AC 98 ms
71,364 KB
testcase_09 AC 95 ms
71,500 KB
testcase_10 AC 96 ms
71,740 KB
testcase_11 AC 95 ms
71,744 KB
testcase_12 AC 95 ms
71,600 KB
testcase_13 AC 96 ms
71,820 KB
testcase_14 AC 96 ms
71,860 KB
testcase_15 AC 101 ms
71,568 KB
testcase_16 AC 228 ms
134,556 KB
testcase_17 AC 201 ms
130,736 KB
testcase_18 AC 205 ms
131,312 KB
testcase_19 AC 204 ms
130,856 KB
testcase_20 AC 210 ms
131,188 KB
testcase_21 AC 206 ms
130,700 KB
testcase_22 AC 214 ms
134,152 KB
testcase_23 AC 215 ms
134,284 KB
testcase_24 AC 210 ms
131,512 KB
testcase_25 AC 208 ms
130,788 KB
testcase_26 AC 361 ms
154,044 KB
testcase_27 AC 363 ms
156,984 KB
testcase_28 AC 359 ms
156,952 KB
testcase_29 AC 345 ms
155,948 KB
testcase_30 AC 359 ms
155,792 KB
testcase_31 AC 232 ms
144,216 KB
testcase_32 AC 232 ms
144,288 KB
testcase_33 AC 212 ms
141,764 KB
testcase_34 AC 215 ms
174,684 KB
testcase_35 AC 242 ms
176,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

from collections import defaultdict

A = list(map(int, input().split()))
A.sort()
D = defaultdict(int)

for a in A:
    D[a] += 1


ans = N

for a in A:
    
    ans += D[a - 1]
    
    D[a + 1] += D[a - 1]
    
print(ans)
0