結果

問題 No.33 アメーバがたくさん
ユーザー convexineqconvexineq
提出日時 2020-11-25 06:55:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 520 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 71,544 KB
最終ジャッジ日時 2023-10-01 01:39:53
合計ジャッジ時間 1,974 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,160 KB
testcase_01 AC 71 ms
71,292 KB
testcase_02 AC 71 ms
71,272 KB
testcase_03 AC 72 ms
71,152 KB
testcase_04 AC 72 ms
71,372 KB
testcase_05 AC 71 ms
71,544 KB
testcase_06 AC 72 ms
71,388 KB
testcase_07 AC 73 ms
71,508 KB
testcase_08 AC 71 ms
71,484 KB
testcase_09 AC 72 ms
71,452 KB
testcase_10 AC 71 ms
71,032 KB
権限があれば一括ダウンロードができます

ソースコード

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():
    event = []
    for i in lst:
        event.append((i-t,1))
        event.append((i+t,2))
    event.sort()
    L = cnt = 0
    for x,v in event:
        if v==1:
            if cnt==0: L = x
            cnt += 1
        else:
            if cnt == 1: ans += x-L+1
            cnt -= 1

print(ans)
0