#include<bits/stdc++.h>
int num = 1, per = 1, now = 1, last = 0, distance[120000], price[120000], buy = 0;
long double oil = 0l, tem = 0l, going = 0;
long long cost = 0;
int main(){
std::cin >> num >> per;
for(int i = 2; i <= num; i++){
std::cin >> distance[i];
}
for(int i = 1; i <= num; i++){
std::cin >> price[i];
}
last = now;
while(now < num){
now++;
going += distance[now];
if(now == num || price[now] < price[last]){
tem = going / per;
tem -= oil;
oil = 0;
buy = tem / 1;
if(tem - buy != 0){
buy++;
}
cost += buy * price[last];
oil = buy - tem;
last = now;
going = 0;
}
}
std::cout << cost;
return 0;
}
洛谷80pts,小图灵25pts,但是全用long long后也只有85/50pts,有哪里写错了吗?求大佬指正Orz