Submission #1225992

#TimeUsernameProblemLanguageResultExecution timeMemory
1225992sokratisi벽 칠하기 (APIO20_paint)C++20
Compilation error
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; }

Compilation message (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);
      |                                                        ^