Submission #973856

# Submission time Handle Problem Language Result Execution time Memory
973856 2024-05-02T11:56:48 Z kl0989e Roses (BOI20_roses) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define all(x) (x).begin(),(x).end()

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    if (b*c>a*d) {
        swap(a,c);
        swap(b,d);
    }
    ll ans=n/a*b;
    if (n%a) {
        ans=min(ans+b,ans+(n%a+c-1)/c*d);
    }
    cout << ans << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -