結果
| 問題 | 
                            No.33 アメーバがたくさん
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-06-14 21:30:56 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 49 ms / 5,000 ms | 
| コード長 | 577 bytes | 
| コンパイル時間 | 319 ms | 
| コンパイル使用メモリ | 82,560 KB | 
| 実行使用メモリ | 55,936 KB | 
| 最終ジャッジ日時 | 2024-06-23 03:24:45 | 
| 合計ジャッジ時間 | 1,439 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 | 
ソースコード
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline
N,D,T = map(int,input().split())
X = list(map(int,input().split()))
Y = defaultdict(lambda:[])
for x in X:
    q,r = divmod(x,D)
    Y[r].append(q)
    
ans = 0
for y in Y.values():
    
    if len(y)==1:
        ans += 2*T+1
        continue
    
    y.sort()
    n = len(y)
    ans += 2*T+1
    for j in range(n-1):
        
        ans += min(y[j+1]-y[j],2*T+1)
print(ans)