結果

問題 No.1268 Fruit Rush 2
ユーザー ayaoniayaoni
提出日時 2020-10-24 00:39:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 429 ms / 2,000 ms
コード長 650 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 205,660 KB
最終ジャッジ日時 2023-09-28 19:45:54
合計ジャッジ時間 10,042 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,596 KB
testcase_01 AC 98 ms
71,900 KB
testcase_02 AC 99 ms
71,596 KB
testcase_03 AC 100 ms
71,692 KB
testcase_04 AC 96 ms
71,696 KB
testcase_05 AC 99 ms
71,552 KB
testcase_06 AC 99 ms
71,372 KB
testcase_07 AC 99 ms
71,784 KB
testcase_08 AC 99 ms
71,756 KB
testcase_09 AC 98 ms
71,820 KB
testcase_10 AC 99 ms
71,760 KB
testcase_11 AC 100 ms
71,796 KB
testcase_12 AC 98 ms
71,672 KB
testcase_13 AC 99 ms
71,492 KB
testcase_14 AC 97 ms
71,788 KB
testcase_15 AC 98 ms
71,612 KB
testcase_16 AC 257 ms
160,032 KB
testcase_17 AC 240 ms
150,092 KB
testcase_18 AC 243 ms
151,052 KB
testcase_19 AC 242 ms
155,760 KB
testcase_20 AC 245 ms
150,348 KB
testcase_21 AC 242 ms
150,216 KB
testcase_22 AC 260 ms
159,944 KB
testcase_23 AC 254 ms
159,768 KB
testcase_24 AC 243 ms
150,956 KB
testcase_25 AC 246 ms
147,924 KB
testcase_26 AC 427 ms
175,332 KB
testcase_27 AC 426 ms
174,944 KB
testcase_28 AC 424 ms
175,056 KB
testcase_29 AC 418 ms
174,892 KB
testcase_30 AC 429 ms
175,184 KB
testcase_31 AC 264 ms
175,880 KB
testcase_32 AC 267 ms
175,688 KB
testcase_33 AC 250 ms
169,424 KB
testcase_34 AC 249 ms
205,660 KB
testcase_35 AC 274 ms
203,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))


N = I()
A = LI()
A.sort()
d = defaultdict(int)  # d[a] == 1 ⇔ a in A
for a in A:
    d[a] = 1

count = defaultdict(int)
# count[a] = A内の要素で構成された初項a、公差2の等差数列の最大の長さ
for a in A:
    count[a] = 0

for a in A:
    if count[a] == 0:
        b = a
        while d[b] == 1:
            b += 2
        r = (b-a)//2
        for i in range(a,b,2):
            count[i] = r-(i-a)//2

ans = N
for a in A:
    ans += count[a+1]

print(ans)
0