제출 #1225989

#제출 시각아이디문제언어결과실행 시간메모리
1225989sokratisi벽 칠하기 (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.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.end()) cur.erase(u);
      |                                                        ^
paint.cpp:19:73: error: request for member 'end' in 'coltoconst', which is of non-class type 'std::set<int> [100005]'
   19 |         for (auto u: cur) if (coltoconst[i].find((u+i)%M) == coltoconst.end()) cur.erase(u);
      |                                                                         ^~~