# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
887513 | 2023-12-14T16:55:40 Z | Ahmed57 | Copy and Paste 3 (JOI22_copypaste3) | C++17 | 8 ms | 49244 KB |
#include <bits/stdc++.h> using namespace std; long long dp[2501][2501],n,a,b,c; string s; int solve(int i,int cu){ if(i==n){ return 0; } if(dp[i][cu]!=-1)return dp[i][cu]; long long c1 = solve(i+1,cu)+a; if(cu&&i+cu<=n)c1 = min(c1,solve(i+cu,cu)+c); if(i>cu)c1 = min(c1,solve(0,i)+b); return dp[i][cu] = c1; } signed main(){ ios_base::sync_with_stdio(0);cin.tie(0); freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); memset(dp,-1,sizeof dp); cin>>n>>s>>a>>b>>c; cout<<solve(0,0)<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 49244 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 49240 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 49244 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 49244 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 49244 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 49244 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |