Submission #887513

# 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
0 / 100
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

copypaste3.cpp: In function 'int main()':
copypaste3.cpp:17:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  freopen("input.txt","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
copypaste3.cpp:18:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  freopen("output.txt","w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 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 -