結果

問題 No.1268 Fruit Rush 2
ユーザー 👑 rin204rin204
提出日時 2022-11-11 16:24:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 186 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 173,488 KB
最終ジャッジ日時 2023-10-11 13:05:43
合計ジャッジ時間 9,553 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,388 KB
testcase_01 AC 71 ms
71,316 KB
testcase_02 AC 70 ms
71,532 KB
testcase_03 AC 72 ms
71,508 KB
testcase_04 AC 74 ms
71,400 KB
testcase_05 AC 74 ms
71,508 KB
testcase_06 AC 71 ms
71,480 KB
testcase_07 AC 71 ms
71,556 KB
testcase_08 AC 71 ms
71,592 KB
testcase_09 AC 72 ms
71,544 KB
testcase_10 AC 71 ms
71,120 KB
testcase_11 AC 72 ms
71,404 KB
testcase_12 AC 71 ms
71,596 KB
testcase_13 AC 72 ms
71,312 KB
testcase_14 AC 72 ms
71,272 KB
testcase_15 AC 72 ms
71,232 KB
testcase_16 AC 176 ms
109,844 KB
testcase_17 AC 161 ms
105,308 KB
testcase_18 AC 163 ms
104,552 KB
testcase_19 AC 162 ms
105,792 KB
testcase_20 AC 162 ms
106,800 KB
testcase_21 AC 161 ms
105,680 KB
testcase_22 AC 170 ms
110,684 KB
testcase_23 AC 168 ms
110,088 KB
testcase_24 AC 159 ms
104,732 KB
testcase_25 AC 161 ms
105,668 KB
testcase_26 AC 242 ms
167,072 KB
testcase_27 AC 247 ms
166,884 KB
testcase_28 AC 245 ms
167,040 KB
testcase_29 AC 247 ms
167,108 KB
testcase_30 AC 248 ms
167,108 KB
testcase_31 AC 190 ms
110,752 KB
testcase_32 AC 185 ms
110,624 KB
testcase_33 AC 168 ms
138,736 KB
testcase_34 AC 170 ms
144,820 KB
testcase_35 AC 191 ms
173,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
A.sort()
dp = {}
for a in A:
    dp[a] = dp.get(a, 0) + 1
    dp[a + 1] = dp.get(a + 1, 0) + dp.get(a - 1, 0)
print(sum(dp.values()))
0