답안 #719638

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
719638 2023-04-06T12:15:08 Z lam Copy and Paste 3 (JOI22_copypaste3) C++14
5 / 100
80 ms 81772 KB
#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';
}

Compilation message

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';
      |                                                             ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 43 ms 47860 KB Output is correct
4 Correct 51 ms 54560 KB Output is correct
5 Correct 79 ms 62300 KB Output is correct
6 Correct 73 ms 71280 KB Output is correct
7 Correct 80 ms 81772 KB Output is correct
8 Correct 76 ms 81692 KB Output is correct
9 Correct 80 ms 81660 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -