結果

問題 No.33 アメーバがたくさん
ユーザー 👑 rin204rin204
提出日時 2022-07-10 14:25:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 71,688 KB
最終ジャッジ日時 2023-08-31 01:21:18
合計ジャッジ時間 1,990 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,568 KB
testcase_01 AC 61 ms
71,524 KB
testcase_02 AC 65 ms
71,288 KB
testcase_03 AC 62 ms
71,444 KB
testcase_04 AC 60 ms
71,504 KB
testcase_05 AC 61 ms
71,632 KB
testcase_06 AC 61 ms
71,524 KB
testcase_07 AC 60 ms
71,672 KB
testcase_08 AC 59 ms
71,308 KB
testcase_09 AC 61 ms
71,688 KB
testcase_10 AC 62 ms
71,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d, t = map(int, input().split())
pos = {}
X = list(map(int, input().split()))
for x in X:
    p = x % d
    x //= d
    mi = x - t
    ma = x + t
    if p not in pos:
        pos[p] = {}
    pos[p][mi] = pos[p].get(mi, 0) + 1
    pos[p][ma + 1] = pos[p].get(ma + 1 , 0) - 1
ans = 0
for dic in pos.values():
    bef = -1
    tot = 0
    for k in sorted(dic.keys()):
        v = dic[k]
        if tot > 0:
            ans += k - bef
        bef = k
        tot += v
print(ans)

0