Submission #850117

# Submission time Handle Problem Language Result Execution time Memory
850117 2023-09-15T18:57:25 Z tvladm2009 Painting Walls (APIO20_paint) C++17
Compilation error
0 ms 0 KB
#include "paint.h"

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, m, k;

int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
        vector<int> a, c;
        vector<vector<int>> b;

        n = N;
        m = M;
        k = K;
        c = C;
        a = A;
        b = B;
        assert((int)c.size() == n);
        assert((int)a.size() == m);
        assert((int)b.size() == m);
        for (int i = 0; i < m; i++) {
                assert((int)b[i].size() == a[i]);
        }

        vector<int> f(n, 0);
        for (int i = 0; i < m; i++) {
                for (auto& it : b[i]) {
                        f[it]++;
                }
        }
        vector<int> has(k, -1);
        vector<int> need(n, 0);
        for (int i = 0; i < n; i++) {
                for (int i = 0; i < m; i++) {
                        for (auto& it : b[i]) {
                                has[it] = i;
                        }
                }
        }

        for (int i = 0; i < n; i++) {
                if (f[c[i]] == 0) {
                        return -1;
                }
                need[i] = has[c[i]];
        }
        int want = need[0];
        int cur = 1;
        for (int i = 1; i < n; i++) {
                want++;
                want %= m;
                if (need[i] != want) {
                        cur++;
                        want = need[i];
                }
        }
        return sol;
}

Compilation message

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:60:16: error: 'sol' was not declared in this scope
   60 |         return sol;
      |                ^~~