結果

問題 No.1268 Fruit Rush 2
ユーザー KudeKude
提出日時 2020-10-23 23:31:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 261 ms / 2,000 ms
コード長 174 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 172,812 KB
最終ジャッジ日時 2023-09-28 18:47:47
合計ジャッジ時間 7,757 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,360 KB
testcase_01 AC 75 ms
71,272 KB
testcase_02 AC 77 ms
71,232 KB
testcase_03 AC 74 ms
70,916 KB
testcase_04 AC 74 ms
71,288 KB
testcase_05 AC 76 ms
71,332 KB
testcase_06 AC 76 ms
71,236 KB
testcase_07 AC 76 ms
71,428 KB
testcase_08 AC 75 ms
71,336 KB
testcase_09 AC 75 ms
71,308 KB
testcase_10 AC 74 ms
71,312 KB
testcase_11 AC 75 ms
71,340 KB
testcase_12 AC 75 ms
71,340 KB
testcase_13 AC 75 ms
71,104 KB
testcase_14 AC 75 ms
71,544 KB
testcase_15 AC 76 ms
71,348 KB
testcase_16 AC 174 ms
109,400 KB
testcase_17 AC 165 ms
104,936 KB
testcase_18 AC 167 ms
107,460 KB
testcase_19 AC 164 ms
103,936 KB
testcase_20 AC 167 ms
111,196 KB
testcase_21 AC 168 ms
106,344 KB
testcase_22 AC 176 ms
110,560 KB
testcase_23 AC 174 ms
109,688 KB
testcase_24 AC 164 ms
108,448 KB
testcase_25 AC 165 ms
106,188 KB
testcase_26 AC 259 ms
166,964 KB
testcase_27 AC 261 ms
166,980 KB
testcase_28 AC 259 ms
167,184 KB
testcase_29 AC 261 ms
166,760 KB
testcase_30 AC 260 ms
166,892 KB
testcase_31 AC 195 ms
110,508 KB
testcase_32 AC 189 ms
110,536 KB
testcase_33 AC 172 ms
138,896 KB
testcase_34 AC 176 ms
144,972 KB
testcase_35 AC 192 ms
172,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = sorted(map(int, input().split()))
d = {}
ans = 0
for ai in a:
    d[ai] = d.get(ai, 0) + 1
    d[ai+1] = d.get(ai-1, 0)
    ans += 1 + d[ai+1]
print(ans)
0