Submission #951138

#TimeUsernameProblemLanguageResultExecution timeMemory
951138turbilegRoses (BOI20_roses)C++14
100 / 100
3 ms600 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n, s, p, k, m, t, q, x, y, ans, res; ll a, b, c, d; cin >> n >> a >> b >> c >> d; ll gc; gc = 1e5; ll mx1 = LONG_MAX; ll mx2 = LONG_MAX; for (int i = 0; i <= gc; i++) { ans = 0; s = n - i * a; ans += i * b; if (s > 0) { if (s % c != 0) ans += (s / c + 1) * d; else ans += s / c * d; } mx1 = min(mx1, ans); } gc = 1e5; for (int i = 0; i <= gc; i++) { ans = 0; s = n - i * c; ans += i * d; if (s > 0) { if (s % a != 0) ans += (s / a + 1) * b; else ans += s / a * b; } mx2 = min(mx2, ans); } ll mx = min(mx1, mx2); cout << mx << endl; return 0; }

Compilation message (stderr)

Roses.cpp: In function 'int main()':
Roses.cpp:7:11: warning: unused variable 'p' [-Wunused-variable]
    7 |  ll n, s, p, k, m, t, q, x, y, ans, res;
      |           ^
Roses.cpp:7:14: warning: unused variable 'k' [-Wunused-variable]
    7 |  ll n, s, p, k, m, t, q, x, y, ans, res;
      |              ^
Roses.cpp:7:17: warning: unused variable 'm' [-Wunused-variable]
    7 |  ll n, s, p, k, m, t, q, x, y, ans, res;
      |                 ^
Roses.cpp:7:20: warning: unused variable 't' [-Wunused-variable]
    7 |  ll n, s, p, k, m, t, q, x, y, ans, res;
      |                    ^
Roses.cpp:7:23: warning: unused variable 'q' [-Wunused-variable]
    7 |  ll n, s, p, k, m, t, q, x, y, ans, res;
      |                       ^
Roses.cpp:7:26: warning: unused variable 'x' [-Wunused-variable]
    7 |  ll n, s, p, k, m, t, q, x, y, ans, res;
      |                          ^
Roses.cpp:7:29: warning: unused variable 'y' [-Wunused-variable]
    7 |  ll n, s, p, k, m, t, q, x, y, ans, res;
      |                             ^
Roses.cpp:7:37: warning: unused variable 'res' [-Wunused-variable]
    7 |  ll n, s, p, k, m, t, q, x, y, ans, res;
      |                                     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...