제출 #1225992

#제출 시각아이디문제언어결과실행 시간메모리
1225992sokratisi벽 칠하기 (APIO20_paint)C++20
컴파일 에러
0 ms0 KiB
#include "paint.h"
#include <vector>
#include <set>

using namespace std;

set<int> coltoconst[100005];

int minimumInstructions(int n, int m, int k, vector<int> c, vector<int> a, vector<vector<int>> b) {
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < a[i]; j++) coltoconst[b[i][j]].insert(i);
    }
    int init = 0;
    int ans = 0;
    bool okay = true;
    set<int> cur;
    cur = coltoconst[0];
    for (int i = 1; i < n; i++) {
        for (auto u: cur) if (coltoconst[i].find((u+i)%M) == coltoconst[i].end()) cur.erase(u);
        if (cur.empty()) {
            if (i - init < k) okay = false;
            ans += (i-init-1)/k + 1;
            init = i;
            cur = coltoconst[i];
        }
    }

    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:19:56: error: 'M' was not declared in this scope
   19 |         for (auto u: cur) if (coltoconst[i].find((u+i)%M) == coltoconst[i].end()) cur.erase(u);
      |                                                        ^