結果
問題 | No.1071 ベホマラー |
ユーザー |
![]() |
提出日時 | 2022-02-11 04:56:36 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 208 ms / 2,000 ms |
コード長 | 961 bytes |
コンパイル時間 | 77 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 22,012 KB |
最終ジャッジ日時 | 2024-06-26 21:49:32 |
合計ジャッジ時間 | 4,581 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
from collections import defaultdict, deque from heapq import heappush, heappop, heapify from itertools import permutations, combinations, accumulate import sys import math import bisect # sys.setrecursionlimit(10**7) # mod = 1000000007 def ii(): return int(input()) def mi(): return map(int, input().split()) def lmi(): return list(mi()) def li(): return list(input()) n, k, x, y = mi() A = lmi() heal_num = [] for i in range(n): num_tmp = 0 - -(A[i] - 1) // k if num_tmp > 0: heal_num.append(num_tmp) heal_num.sort(reverse=True) l = len(heal_num) if l == 0: print(0) exit() # print(f'{heal_num=}') behoma_bound = y // x # print(f'{behoma_bound=}') if behoma_bound <= 0: behomara_num = heal_num[0] elif behoma_bound > l: behomara_num = 0 else: behomara_num = heal_num[behoma_bound] # print(f'{behomara_num=}') ans = y * behomara_num for i in range(l): ans += max(0, (heal_num[i] - behomara_num) * x) print(ans)