Submission #591865

# Submission time Handle Problem Language Result Execution time Memory
591865 2022-07-08T05:17:31 Z 반딧불(#8422) Copy and Paste 3 (JOI22_copypaste3) C++17
5 / 100
16 ms 328 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n;
ll a, b, c;
int arr[2502];
ll DP[2502];

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        char c;
        scanf(" %c", &c);
        arr[i] = c - 'a';
    }
    scanf("%lld %lld %lld", &a, &b, &c);

    DP[0] = 0, DP[1] = a+b;
    for(int i=2; i<=n; i++){
        DP[i] = a*i+b;
        for(int j=1; j<i; j++){
            DP[i] = min(DP[i], DP[j] + c*(i/j) + a*(i%j) + b);
        }
    }
    printf("%lld", DP[n]-b);
}

Compilation message

copypaste3.cpp: In function 'int main()':
copypaste3.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
copypaste3.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf(" %c", &c);
      |         ~~~~~^~~~~~~~~~~
copypaste3.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     scanf("%lld %lld %lld", &a, &b, &c);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 9 ms 212 KB Output is correct
4 Correct 10 ms 212 KB Output is correct
5 Correct 13 ms 212 KB Output is correct
6 Correct 14 ms 212 KB Output is correct
7 Correct 15 ms 328 KB Output is correct
8 Correct 16 ms 324 KB Output is correct
9 Correct 16 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 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 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -