結果
| 問題 |
No.33 アメーバがたくさん
|
| コンテスト | |
| ユーザー |
しらっ亭
|
| 提出日時 | 2015-11-26 15:24:59 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 733 bytes |
| コンパイル時間 | 281 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-09-24 10:30:31 |
| 合計ジャッジ時間 | 1,189 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 5 |
ソースコード
from collections import defaultdict
def solve():
N, D, T = map(int, input().split())
X = list(map(int, input().split()))
def count(ys):
if len(ys) == 0:
return 0
mi = ys[0]
ma = ys[-1]
return 2 * T + 1 + ma - mi
groups = defaultdict(list)
for x in X:
groups[x % D].append(x // D)
ans = 0
for m in groups:
xs = groups[m]
xs.sort()
p = -float('inf')
ys = []
for x in xs:
if abs(p - x) <= T:
ys.append(x)
else:
ans += count(ys)
ys = [x]
p = x
ans += count(ys)
print(ans)
if __name__ == '__main__':
solve()
しらっ亭