結果

問題 No.33 アメーバがたくさん
ユーザー convexineq
提出日時 2020-11-25 07:06:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,208 KB
実行使用メモリ 53,632 KB
最終ジャッジ日時 2024-07-23 19:12:24
合計ジャッジ時間 1,179 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d,t = map(int,input().split())
*x, = map(int,input().split())
dic = {}
for xi in x:
    pi,qi = xi//d,xi%d
    if qi in dic:
        dic[qi].append(pi)
    else:
        dic[qi] = [pi]

ans = 0
for lst in dic.values():
    lst.sort()
    st = []
    for i in lst:
        if st and st[-1][1] >= i-t:
            st[-1][1] = i+t
        else:
            st.append([i-t,i+t])
    for L,R in st:
        ans += R-L+1

print(ans)
0