Submission #642402

# Submission time Handle Problem Language Result Execution time Memory
642402 2022-09-19T11:02:28 Z Erennedirlo Roses (BOI20_roses) C++17
0 / 100
1 ms 312 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

int32_t main() {
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;

  int c1, c2, c3, c4;
  c1 = ((n - 1) / a + 1) * b;
  c3 = ((n - 1) / c + 1) * d;

  c2 = (n / a) * b + (((n % a) - 1) / c + 1) * d;
  if ((n - c) % a == 0 && n-c > 0)
    c2 = d + ((n - c) / a) * b;

  c4 = (n / c) * d + (((n % c) - 1) / a + 1) * b;
  if ((n - a) % c == 0 && n-a > 0)
    c4 = b + ((n - a) / c) * d;

  cout << min(c1, min(c2, min(c3, c4))) << "\n";

  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Incorrect 0 ms 304 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Incorrect 0 ms 304 KB Output isn't correct
20 Halted 0 ms 0 KB -