Submission #949409

# Submission time Handle Problem Language Result Execution time Memory
949409 2024-03-19T08:12:31 Z vjudge1 Painting Walls (APIO20_paint) C++17
0 / 100
0 ms 348 KB
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
#define size(x) (int)x.size()
#define all(x) x.begin(), x.end()

template<class S, class T> bool chmin(S& a, const T& b) {
  return a > b ? (a = b) == b : false;
}
template<class S, class T> bool chmax(S& a, const T& b) {
  return a < b ? (a = b) == b : false;
}
const int inf = 1e9;

int minimumInstructions(int n, int m, int K, 
  vector<int> c, vector<int> a, vector<vector<int>> B) {
  if (n % m) return -1;
  deque<vector<int>> b(m);
  for (int i = 0; i < m; ++i) {
    b[i].resize(a[i]);
    for (int j = 0; j < a[i]; ++j) {
      b[i][j] = B[i][j];
    }
  }
  int k = -1;
  for (int i = 0; i < m; ++i) {
    if (binary_search(all(b[i]), c[0])) {
      k = i;
      break;
    }
  }
  if (k == -1) return -1;
  while (k--) {
    b.push_back(b.front());
    b.pop_front();
  }
  for (int i = 0; i < n; i += m) {
    for (int j = 0; j < m; ++j) {
      if (!binary_search(all(b[j]), c[i + j])) {
        return -1;
      }
    }
  }
  return n / m;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -