結果
問題 |
No.1071 ベホマラー
|
ユーザー |
![]() |
提出日時 | 2020-06-15 17:44:16 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 726 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 106,900 KB |
最終ジャッジ日時 | 2024-07-03 11:29:56 |
合計ジャッジ時間 | 5,501 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 WA * 1 |
other | AC * 8 WA * 12 |
ソースコード
import sys import math import itertools import bisect from copy import copy from collections import deque,Counter from decimal import Decimal def s(): return input() def i(): return int(input()) def S(): return input().split() def I(): return map(int,input().split()) def L(): return list(input().split()) def l(): return list(map(int,input().split())) def lcm(a,b): return a*b//math.gcd(a,b) sys.setrecursionlimit(10 ** 9) mod = 10**9+7 N,K,X,Y = I() A = l() A.sort(reverse=True) A = [math.ceil((A[i]-1)/K) for i in range(N)] B = math.ceil(X/Y) if X > Y: print(max(A)) exit() if X*N < Y: B = N+1 C = A[0:B] if A[B:]: D = max(A[B:]) else: D = 0 ans = 0 for c in C: ans += X*(c-D) ans += D*Y print(ans)