제출 #719638

#제출 시각아이디문제언어결과실행 시간메모리
719638lamCopy and Paste 3 (JOI22_copypaste3)C++14
5 / 100
80 ms81772 KiB
#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) 메시지

copypaste3.cpp: In function 'int main()':
copypaste3.cpp:27:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   27 |     for (int len=0; len<=n; len++) ans=min(ans,dp[n][len]); cout<<ans<<'\n';
      |     ^~~
copypaste3.cpp:27:61: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   27 |     for (int len=0; len<=n; len++) ans=min(ans,dp[n][len]); cout<<ans<<'\n';
      |                                                             ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...