답안 #396491

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
396491 2021-04-30T04:22:33 Z wenqi Roses (BOI20_roses) C++14
0 / 100
1 ms 316 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

ll N;
ll A, B, C, D;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> A >> B >> C >> D;

	if(C * B > A * D) {
		swap(A, C);
		swap(B, D);
	}

	ll mn = 1e18;

	for(int k = 0; k < max(A, C); k++) {
		ll left = N - k * C;
		ll cnt = left ? (left - 1) / A + 1 : 0;
		mn = min(mn, cnt * B + k * D);
	}
	cout << mn << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Halted 0 ms 0 KB -