Submission #770325

#TimeUsernameProblemLanguageResultExecution timeMemory
770325petezaCopy and Paste 3 (JOI22_copypaste3)C++14
5 / 100
14 ms328 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int n; string s; ll a, b, c; ll dp[3000]; int main() { cin >> n >> s >> a >> b >> c; dp[1] = a; for(int i=2;i<=n;i++) { dp[i] = 1ll*i*a; for(int j=1;j<i;j++) dp[i] = min(dp[i], dp[j] + b + (i/j)*c + (i%j)*a); } cout << dp[n]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...