답안 #770406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
770406 2023-07-01T07:23:05 Z Plurm Copy and Paste 3 (JOI22_copypaste3) C++11
6 / 100
15 ms 340 KB
#include <bits/stdc++.h>
using namespace std;

long long dp[2505];
int main() {
    int n;
    string s;
    int a, b, c;
    cin >> n >> s >> a >> b >> c;
    if (n == 3) {
        set<char> st;
        st.insert(s[0]);
        st.insert(s[1]);
        st.insert(s[2]);
        if (st.size() == 3)
            cout << 3ll * a << endl;
        else if (st.size() == 2)
            cout << min(3ll * a, 2ll * a + b + 2ll * c) << endl;
        else
            cout << min({3ll * a, 2ll * a + b + 2ll * c, a + b + 3ll * c})
                 << endl;
    } else {
        dp[1] = a;
        for (int i = 2; i <= n; i++) {
            dp[i] = dp[i - 1] + a;
            for (int j = 1; j < i; j++) {
                dp[i] = min(dp[i], dp[j] + dp[i - j]);
                dp[i] = min(dp[i], dp[j] + b + 1ll * c * (i / j) + dp[i % j]);
            }
        }
        cout << dp[n] << endl;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 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 Correct 8 ms 212 KB Output is correct
4 Correct 9 ms 340 KB Output is correct
5 Correct 11 ms 316 KB Output is correct
6 Correct 12 ms 316 KB Output is correct
7 Correct 14 ms 320 KB Output is correct
8 Correct 15 ms 328 KB Output is correct
9 Correct 14 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 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 8 ms 212 KB Output is correct
14 Correct 9 ms 340 KB Output is correct
15 Correct 11 ms 316 KB Output is correct
16 Correct 12 ms 316 KB Output is correct
17 Correct 14 ms 320 KB Output is correct
18 Correct 15 ms 328 KB Output is correct
19 Correct 14 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Incorrect 0 ms 212 KB Output isn't correct
29 Halted 0 ms 0 KB -