답안 #634553

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634553 2022-08-24T14:49:09 Z Darren0724 Copy and Paste 3 (JOI22_copypaste3) C++17
5 / 100
49 ms 49360 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define rz resize
#define pb emplace_back
int INF=1e18;
int mod=1e9+7;

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  string s;cin>>s;
  int a,b,c;cin>>a>>b>>c;
  vector<vector<int>> dp(n+1,vector<int>(n+1,INF));
  dp[0][0]=0;
  for(int i=0;i<=n;i++){
    for(int j=i;j<=n;j++){
      dp[i][j]=min(dp[i][j],dp[i][j-i]+c);
      dp[i][j]=min(dp[i][j],dp[i][j-1]+a);
      dp[j][0]=min(dp[j][0],dp[i][j]+b);
    }
  }
  int ans=INF;
  for(int i=0;i<=n;i++){
    ans=min(ans,dp[i][n]);
  }
  cout<<ans<<endl;


  return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 22 ms 26568 KB Output is correct
4 Correct 31 ms 31012 KB Output is correct
5 Correct 32 ms 36220 KB Output is correct
6 Correct 49 ms 42248 KB Output is correct
7 Correct 44 ms 49360 KB Output is correct
8 Correct 47 ms 49332 KB Output is correct
9 Correct 48 ms 49264 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -