# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
784387 | 2023-07-16T05:08:15 Z | Hanksburger | Painting Walls (APIO20_paint) | C++17 | 2 ms | 3796 KB |
#include "paint.h" #include <bits/stdc++.h> using namespace std; vector<int> v[100005], w[50005]; int ok[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++) v[b[i][j]].push_back(i); for (int i=0; i<n; i++) for (int j=0; j<v[c[i]].size(); j++) w[(v[c[i]][j]-i+n)%m].push_back(i); for (int i=0; i<m; i++) { int cnt; for (int j=0; j<w[i].size(); j++) { if (j && w[i][j]-w[i][j-1]==1) cnt++; else cnt=1; if (cnt>=m) ok[w[i][j]]=1; } } if (!ok[m-1]) return 0; int ind=m-1, ans=1; while (ind<n-1) { int pre=ind; for (int i=min(n-1, ind+m); i>ind; i--) { if (ok[i]) { ind=i; break; } } if (ind==pre) return 0; ans++; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3796 KB | Output is correct |
2 | Correct | 2 ms | 3796 KB | Output is correct |
3 | Incorrect | 2 ms | 3796 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3796 KB | Output is correct |
2 | Correct | 2 ms | 3796 KB | Output is correct |
3 | Incorrect | 2 ms | 3796 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3796 KB | Output is correct |
2 | Correct | 2 ms | 3796 KB | Output is correct |
3 | Incorrect | 2 ms | 3796 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3796 KB | Output is correct |
2 | Correct | 2 ms | 3796 KB | Output is correct |
3 | Incorrect | 2 ms | 3796 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3796 KB | Output is correct |
2 | Correct | 2 ms | 3796 KB | Output is correct |
3 | Incorrect | 2 ms | 3796 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |