Submission #544680

#TimeUsernameProblemLanguageResultExecution timeMemory
544680pokmui9909주유소 (KOI16_gasM)C++17
100 / 100
29 ms3280 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...