結果

問題 No.33 アメーバがたくさん
ユーザー zimphazimpha
提出日時 2017-12-12 22:04:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 452 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 71,440 KB
最終ジャッジ日時 2023-08-20 23:36:40
合計ジャッジ時間 2,098 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,184 KB
testcase_01 AC 75 ms
71,196 KB
testcase_02 AC 71 ms
71,340 KB
testcase_03 AC 72 ms
71,440 KB
testcase_04 AC 72 ms
71,204 KB
testcase_05 AC 70 ms
71,248 KB
testcase_06 AC 72 ms
71,064 KB
testcase_07 AC 70 ms
71,212 KB
testcase_08 AC 71 ms
71,164 KB
testcase_09 AC 70 ms
71,052 KB
testcase_10 AC 72 ms
71,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d, t = list(map(int, input().split()))
pos = dict()
for x in map(int, input().split()):
  y = (x % d + d) % d
  if y in pos:
    pos[y].append(x)
  else:
    pos[y] = [x]
ret = 0
for k, v in pos.items():
  seg = []
  for x in v:
    seg.append((x - d * t, x + d * t))
  seg.sort()
  l, r = seg[0]
  for e in seg[1:]:
    if e[0] <= r:
      r = max(r, e[1])
    else:
      ret += (r - l) // d + 1
      l, r = e
  ret += (r - l) // d + 1
print(ret)
0