Submission #951121

# Submission time Handle Problem Language Result Execution time Memory
951121 2024-03-21T07:34:38 Z turbileg Roses (BOI20_roses) C++14
0 / 100
1 ms 348 KB
#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 mx1 = 0;
	ll mx2 = 0;
	ans = 0;

	s = n - a;
	mx1 = b;
	if (n % a != 0) mx1 = min(mx1, (n / a + 1) * b);
	if (s > 0) {
		if (s % c != 0) s = s / c + 1;
		else s = s / c;

		mx1 += s * d;
	}
	
	s = n - c;
	mx2 = d;
	if (n % c != 0) mx1 = min(mx1, (n / c + 1) * d);
	if (s > 0) {
		if (s % a != 0) s = s / a + 1;
		else s = s / a;

		mx2 += s * b;
	}

	cout << min(mx1, mx2) << endl;

	return 0;
}

Compilation message

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:32: warning: variable 'ans' set but not used [-Wunused-but-set-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 time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -