# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
719638 | lam | Copy and Paste 3 (JOI22_copypaste3) | C++14 | 80 ms | 81772 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a,b,c;
string s;
const int maxn = 5010;
int dp[maxn][maxn];
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
cin>>n;
cin>>s;
cin>>a>>b>>c;
for (int i=0; i<=n; i++)
for (int j=0; j<=n; j++) dp[i][j] = 1e18;
dp[0][0] = 0;
for (int i=0; i<n; i++)
for (int len=0; len<=n; len++)
{
if (dp[i][len]==1e18) continue;
dp[i][i] = min(dp[i][i],dp[i][len] + b+c);
dp[i+len][len] = min(dp[i+len][len],dp[i][len] + c);
dp[i+1][len] = min(dp[i+1][len],dp[i][len] + a);
}
int ans = 1e18;
for (int len=0; len<=n; len++) ans=min(ans,dp[n][len]); cout<<ans<<'\n';
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |