제출 #567337

#제출 시각아이디문제언어결과실행 시간메모리
567337Stickfish벽 칠하기 (APIO20_paint)C++17
0 / 100
0 ms212 KiB
#include "paint.h" #include <vector> #include <bitset> using namespace std; const int MAXN = 501; const int MAXM = 201; bitset<MAXM> goodseg[MAXN]; bitset<MAXM> rgoodcl[MAXN]; bool get_good_seg(int n, int m, int k, vector<int>& cl, vector<vector<int>>& goodcl, int l) { if (l > n - m) return false; return goodseg[l].count(); } int minimumInstructions(int n, int m, int k, vector<int> cl, vector<int> a, vector<vector<int>> goodcl) { for (int i = 0; i < n; ++i) { --cl[i]; for (int j = 0; j < m; ++j) goodseg[i][j] = 1; } for (int i = 0; i < m; ++i) { for (auto ccl : goodcl[i]) rgoodcl[ccl][i] = 1; } for (int i = 0; i < n; ++i) { bitset<MAXM> curgoodcl = rgoodcl[cl[i]]; for (int j = i; j >= 0 && j > i - m; --j) { goodseg[j] &= curgoodcl; curgoodcl[m] = curgoodcl[0]; curgoodcl = curgoodcl >> 1; } } int endcvr = 0; int maxcvr = 0; int ans = 0; for (int i = 0; i < n; ++i) { if (get_good_seg(n, m, k, cl, goodcl, i)) maxcvr = i + m; if (i >= endcvr) { endcvr = maxcvr; ++ans; } if (i >= endcvr) return -1; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...