This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <deque>
#include <functional>
#include <climits>
#include <set>
#include <map>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
using namespace std;
using ll = long long;
int n;
ll oil[100005], dist[100005];
ll ans = 0;
int main()
{
cin.tie(NULL); cout.tie(NULL);
ios_base::sync_with_stdio(false);
cin >> n;
for (int i = 0; i < n - 1; i++) cin >> dist[i];
for (int i = 0; i < n; i++) cin >> oil[i];
ll mn = oil[0]; ll ans = 0;
for (int i = 1; i < n; i++)
{
ans += mn * dist[i - 1];mn = min(mn, oil[i]);
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |