結果

問題 No.33 アメーバがたくさん
ユーザー ayaoniayaoni
提出日時 2020-12-04 17:11:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 781 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 71,900 KB
最終ジャッジ日時 2023-10-13 06:38:42
合計ジャッジ時間 2,250 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,544 KB
testcase_01 AC 88 ms
71,772 KB
testcase_02 AC 88 ms
71,648 KB
testcase_03 AC 87 ms
71,540 KB
testcase_04 AC 86 ms
71,900 KB
testcase_05 AC 88 ms
71,736 KB
testcase_06 AC 89 ms
71,556 KB
testcase_07 AC 89 ms
71,408 KB
testcase_08 AC 87 ms
71,644 KB
testcase_09 AC 88 ms
71,824 KB
testcase_10 AC 86 ms
71,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,D,T = MI()
X = LI()

d = defaultdict(list)
for x in X:
    d[x % D].append(x)

ans = 0
for key in d.keys():
    A = d[key]
    A.sort()
    l = len(A)
    count = l*(2*T+1)
    for i in range(l-1):
        a,b = A[i],A[i+1]
        count -= max(0,2*T+1-(b-a)//D)
    ans += count

print(ans)
0