Submission #979611

#TimeUsernameProblemLanguageResultExecution timeMemory
979611vjudge1Painting Walls (APIO20_paint)C++17
Compilation error
0 ms0 KiB
#include "paint.h" #include<bits/stdc++.h> using namespace std; const int INF = 1e9; ll _ok[600][600]; int eq(vector<int> c, int p, vector<vector<int>> b, int m) { int ok = 1; for(int i = p; i < p + m; ++i) ok &= _ok[i - p][i]; return ok; } void sdvig(vector<vector<int>> &b, int m) { for(int i = 0; i < m - 1; ++i) swap(b[i], b[i + 1]); } int minimumInstructions(int n, int m, int k, vector<int> c, vector<int> a, vector<vector<int>> b) { int i, j; int dp[n + 5] = {}; for(i = 0; i < n; ++i) for(j = 0; j < m; ++j) for(int r : b[j]) _ok[j][i] |= (r == c[i]); for(i = 0; i <= n - m; ++i) { for(int t = 0; t < m && !dp[i]; ++t) { if(eq(c, i, b, m)) dp[i] = 1; sdvig(b, m); } } int ans = 1, cur = 0; while(cur < n - m) { int lst = INF; for(i = cur + 1; i <= cur + m; ++i) if(dp[i]) lst = i; cur = lst; ++ans; } // for(i = 0; i < n; ++i) // cout << dp[i] << ' '; // return; return (cur < INF ? ans : -1); } //int main() //{ //// ios_base::sync_with_stdio(0); //// cin.tie(0), cout.tie(0); //// solve(); //} //8 3 5 //3 3 1 3 4 4 2 2 //3 0 1 2 //2 2 3 //2 3 4

Compilation message (stderr)

paint.cpp:5:1: error: 'll' does not name a type
    5 | ll _ok[600][600];
      | ^~
paint.cpp: In function 'int eq(std::vector<int>, int, std::vector<std::vector<int> >, int)':
paint.cpp:10:15: error: '_ok' was not declared in this scope; did you mean 'ok'?
   10 |         ok &= _ok[i - p][i];
      |               ^~~
      |               ok
paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:27:17: error: '_ok' was not declared in this scope
   27 |                 _ok[j][i] |= (r == c[i]);
      |                 ^~~