# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
795396 | vjudge1 | Copy and Paste 3 (JOI22_copypaste3) | C++17 | 1 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#ifdef Home
#define _GLIBCXX_DEBUG
#endif // Home
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
main() {
#ifdef Home
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // Home
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n, a, b, c, d = 0;
string s;
cin >> n >> s;
cin >> a >> b >> c;
ll dp[n + 1];
dp[0] = 0;
for(int i = 1; i <= n; ++ i) {
dp[i] = 1e18;
}
for(int i = 1; i <= n; ++ i) {
dp[i] = min(dp[i], dp[i - 1] + a);
for(int j = i + i; j <= n; j += i) {
dp[j] = min(dp[j], dp[i] + b + (j / i) * c);
}
}
cout << dp[n];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |