QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#866135#3504. Copy and Paste 3Wansur#0 1ms3712kbC++23899b2025-01-22 12:47:562025-01-22 12:47:56

Judging History

你现在查看的是最新测评结果

  • [2025-01-22 12:47:56]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3712kb
  • [2025-01-22 12:47:56]
  • 提交

answer

#include <bits/stdc++.h>
#define ent '\n'
#define int long long

using namespace std;

const int maxn = 1500 + 12;

int dp[maxn][maxn];
int n, m, k;
int a, b, c;

void solve() {
    string s;
    cin >> n >> s >> 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 j = 1; j <= n; j++) {
        dp[0][j] = j * a + c;
    }
    for(int i = 0; i <= n; i++) {
        for(int j = 0; j <= n; j++) {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + a);
            dp[i + j][j] = min(dp[i + j][j], dp[i][j] + c);
        }
    }
    cout << *min_element(dp[n], dp[n] + n + 1) << ent;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3712kb

input:

3
ppp
62048289
882376
73

output:

62048581

result:

wrong answer 1st lines differ - expected: '62930884', found: '62048581'

Subtask #2:

score: 0
Runtime Error

Test #9:

score: 0
Runtime Error

input:

1828
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:


result:


Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%