diff --git a/storage/jungol/cpp/completed/2194.cpp b/storage/jungol/cpp/completed/2194.cpp new file mode 100644 index 0000000..10af56c --- /dev/null +++ b/storage/jungol/cpp/completed/2194.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#define let auto +#define fn auto +#define usize size_t +using namespace std; + +#define LIMIT (((usize) 1 << 63) - 1); + +fn fastio() { + ios::sync_with_stdio(false); + cin.tie(nullptr); +} + +fn main() -> int { + fastio(); + usize n, s; + cin >> n >> s; + let costs = vector(n); + let yopps = vector(n); + // it needs cost S for storing 1 litre of milk for a week. + let cummin = vector(n); + + for (usize i = 0; i < n; i++) { + cin >> costs[i] >> yopps[i]; + } + + let curr_min = (usize) LIMIT; + + for (usize i = 0; i < n; i++) { + curr_min = min(curr_min + s, costs[i]); + cummin[i] = curr_min; + } + + let total = (usize) 0; + for (usize i = 0; i < n; i++) { + total += cummin[i] * yopps[i]; + } + + cout << total << endl; +} \ No newline at end of file diff --git a/storage/jungol/cpp/3521.cpp b/storage/jungol/cpp/completed/3521.cpp similarity index 100% rename from storage/jungol/cpp/3521.cpp rename to storage/jungol/cpp/completed/3521.cpp diff --git a/storage/jungol/cpp/4520.cpp b/storage/jungol/cpp/completed/4520.cpp similarity index 100% rename from storage/jungol/cpp/4520.cpp rename to storage/jungol/cpp/completed/4520.cpp