Submission #887518

# Submission time Handle Problem Language Result Execution time Memory
887518 2023-12-14T16:56:55 Z Ahmed57 Copy and Paste 3 (JOI22_copypaste3) C++17
5 / 100
144 ms 49808 KB
#include <bits/stdc++.h>
using namespace std;
long long dp[2501][2501],n,a,b,c;
string s;
long long 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;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 49240 KB Output is correct
2 Correct 6 ms 49244 KB Output is correct
3 Incorrect 6 ms 49244 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 49244 KB Output is correct
2 Correct 6 ms 49368 KB Output is correct
3 Correct 80 ms 49620 KB Output is correct
4 Correct 86 ms 49808 KB Output is correct
5 Correct 99 ms 49668 KB Output is correct
6 Correct 118 ms 49688 KB Output is correct
7 Correct 135 ms 49752 KB Output is correct
8 Correct 138 ms 49712 KB Output is correct
9 Correct 144 ms 49708 KB Output is correct
10 Correct 6 ms 49496 KB Output is correct
11 Correct 6 ms 49292 KB Output is correct
12 Correct 6 ms 49288 KB Output is correct
13 Correct 7 ms 49368 KB Output is correct
14 Correct 6 ms 49244 KB Output is correct
15 Correct 7 ms 49244 KB Output is correct
16 Correct 6 ms 49240 KB Output is correct
17 Correct 7 ms 49756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 49240 KB Output is correct
2 Correct 6 ms 49244 KB Output is correct
3 Incorrect 6 ms 49244 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 49240 KB Output is correct
2 Correct 6 ms 49244 KB Output is correct
3 Incorrect 6 ms 49244 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 49240 KB Output is correct
2 Correct 6 ms 49244 KB Output is correct
3 Incorrect 6 ms 49244 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 49240 KB Output is correct
2 Correct 6 ms 49244 KB Output is correct
3 Incorrect 6 ms 49244 KB Output isn't correct
4 Halted 0 ms 0 KB -