답안 #544680

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
544680 2022-04-02T14:21:33 Z pokmui9909 주유소 (KOI16_gasM) C++17
100 / 100
29 ms 3280 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 2516 KB Output is correct
2 Correct 11 ms 2160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 2516 KB Output is correct
2 Correct 11 ms 2160 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 3 ms 596 KB Output is correct
12 Correct 6 ms 1236 KB Output is correct
13 Correct 20 ms 3276 KB Output is correct
14 Correct 29 ms 3280 KB Output is correct
15 Correct 14 ms 2644 KB Output is correct