Submission #1305986

#TimeUsernameProblemLanguageResultExecution timeMemory
1305986zertinii02Stove (JOI18_stove)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define ios ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin() + 1, (x).rend()
#define fi first
#define se second
#define yes cout << "YES" << '\n'
#define no cout << "NO" << '\n'
#define int long long
#define veci vector<int>
#define skip continue
#define sz size()
#define pii pair<int,int>

const int mod = 1e9 + 7;
const int N = 2e6 + 7;
const int inf = 1e18;

void zertinii() {
    int n, m;
    cin >> n >> m;
    veci a(n + 1);
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    int b[n + 1][n + 1];
    for(int i = 1;i <= n;i++) {
        for(int j = 1;j <= n;j++) {
            b[i][j] = (a[j] + 1) - a[i];
        }
    }
    c[0][0] = 0;
    int c[n + 1][m + 1];
    for(int i = 1;i <= n;i++) {
        for(int j = 1;j <= m;j++) {
            c[i][j] = inf;
        }
    }
    for(int i = 1;i <= n;i++) {
        for(int j = 1;j <= m;j++) {
            for(int k = 0;k < i;k++) {
                c[i][j] = min(c[i][j], c[k][j - 1] + b[k + 1][i]);
            }
        }
    }
    int mins = inf;
    for(int i = 1;i <= m;i++) {
        mins = min(mins, c[n][i]);
    }
    cout << mins;
}
signed main() {
    ios;
    int t = 1;
    //cin >> t;
    while(t--) {
        zertinii();
    }
    return 0;
}

Compilation message (stderr)

stove.cpp: In function 'void zertinii()':
stove.cpp:35:5: error: 'c' was not declared in this scope
   35 |     c[0][0] = 0;
      |     ^