| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1331163 | Zone_zonee | Roses (BOI20_roses) | C++20 | 7 ms | 452 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll divide(ll a, ll b){
if(a%b == 0) return a/b;
return a/b+1;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
ll res = 2e18;
for (int i = 0; i <= 1000000; ++i) if (a*i <= n) res = min(res, b*i+divide(n-a*i, c)*d);
for (int i = 0; i <= 1000000; ++i) if (c*i <= n) res = min(res, d*i+divide(n-c*i, a)*b);
cout << res << '\n';
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
