結果

問題 No.33 アメーバがたくさん
ユーザー mkawa2mkawa2
提出日時 2020-01-06 16:50:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 513 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 8,672 KB
最終ジャッジ日時 2023-08-14 22:42:35
合計ジャッジ時間 1,063 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,600 KB
testcase_01 AC 19 ms
8,508 KB
testcase_02 AC 18 ms
8,672 KB
testcase_03 AC 18 ms
8,468 KB
testcase_04 AC 18 ms
8,604 KB
testcase_05 AC 18 ms
8,604 KB
testcase_06 AC 19 ms
8,656 KB
testcase_07 AC 18 ms
8,604 KB
testcase_08 AC 19 ms
8,644 KB
testcase_09 AC 19 ms
8,604 KB
testcase_10 AC 18 ms
8,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
from collections import *
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))

def main():
    n,d,t=MI()
    xx=LI()
    xx.sort()
    mod_d=defaultdict(list)
    for x in xx:
        mod_d[x%d].append(x//d)
    #print(mod_d)
    ans=0
    for xx in mod_d.values():
        cur=2*t+1
        for x0,x1 in zip(xx,xx[1:]):
            cur+=2*t+1-max(0,x0+2*t-x1+1)
        ans+=cur
    print(ans)

main()
0