結果

問題 No.33 アメーバがたくさん
ユーザー vwxyzvwxyz
提出日時 2021-12-23 01:29:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 374 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 10,500 KB
実行使用メモリ 8,556 KB
最終ジャッジ日時 2023-10-15 04:18:21
合計ジャッジ時間 1,050 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,556 KB
testcase_01 AC 19 ms
8,456 KB
testcase_02 AC 18 ms
8,492 KB
testcase_03 AC 18 ms
8,424 KB
testcase_04 AC 18 ms
8,388 KB
testcase_05 AC 18 ms
8,480 KB
testcase_06 AC 18 ms
8,384 KB
testcase_07 AC 17 ms
8,544 KB
testcase_08 AC 18 ms
8,544 KB
testcase_09 AC 18 ms
8,420 KB
testcase_10 AC 18 ms
8,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
readline=sys.stdin.readline

N,D,T=map(int,readline().split())
dct=defaultdict(list)
for x in map(int,readline().split()):
    dct[x%D].append(x)
ans=0
for lst in dct.values():
    lst=sorted([x//D for x in lst])
    l=len(lst)
    ans+=l
    ans+=2*T
    for i in range(l-1):
        ans+=min(lst[i+1]-lst[i]-1,2*T)
print(ans)
0