0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 23:58:48 +00:00
Baoshuo Ren 2022-07-02 20:55:13 +08:00
parent 4fec3f5288
commit 05a190d4b2
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

29
AtCoder/ABC258/D/D.cpp Normal file
View File

@ -0,0 +1,29 @@
#include <iostream>
#include <limits>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 2e5 + 5;
int n, x, a, b;
long long sum, ans = std::numeric_limits<long long>::max();
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> x;
for (int i = 1; i <= std::min(x, n); i++) {
cin >> a >> b;
sum += a + b;
ans = std::min(ans, sum + 1ll * (x - i) * b);
}
cout << ans << endl;
return 0;
}