Submission #1018684

#TimeUsernameProblemLanguageResultExecution timeMemory
1018684UnforgettableplCopy and Paste 3 (JOI22_copypaste3)C++17
5 / 100
7 ms600 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,a,b,c; string s; cin >> n >> s >> a >> b >> c; s.insert(s.begin(),'$'); vector<int> DP(n+1); for(int i=1;i<=n;i++){ DP[i] = i*a; for(int x=1;x<i;x++)DP[i]=min(DP[i],DP[x]+b+c*(i/x)+a*(i%x)); } cout << DP[n] << '\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...