結果

問題 No.33 アメーバがたくさん
ユーザー ゆるく
提出日時 2014-11-25 00:34:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 605 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-09-24 09:58:06
合計ジャッジ時間 1,083 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque, OrderedDict
from copy import deepcopy

N, D, T = map(int, input().split())

L = deque(list(map(int, input().split())))
V = defaultdict(list)
for l in L:
  x = (l + 10 ** 9) % D
  V[x].append((l + 10 ** 9) // D)
count = 0
for v in V:
  a = V[v]
  a.sort()
  m = -(10 ** 9)
  for i in a:
    right = i + T
    left = i - T
    if m >= left:
      left = m + 1
    count += right - left + 1
    m = right
print(count)
0