Submission #361428

# Submission time Handle Problem Language Result Execution time Memory
361428 2021-01-30T05:14:13 Z spatarel Vision Program (IOI19_vision) C++17
0 / 100
14 ms 1900 KB
#include "vision.h"

int H, W;

int index(int i, int j) {
  return i * W + j;
}

void construct_network(int H, int W, int K) {
  ::H = H;
  ::W = W;
  
  std::vector<int> diagCells[2][H + W - 1];
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      diagCells[0][i + j].push_back(index(i, j));
      diagCells[1][i - j + W - 1].push_back(index(i, j));
    }
  }
  
  int diagContains[2][H + W - 1];
  std::vector<int> diagEqKANDs[2];
  int diagPrefContains[2][H + W - 1];
  int diagSuffContains[2][H + W - 1];
  int diagEqK[2];
  int diagLEqK[2];
  for (int d : {0, 1}) {
    for (int i = 0; i < W + H - 1; i++) {
      diagContains[d][i] = add_or(diagCells[d][i]);
    }
    diagPrefContains[d][0] = diagContains[d][0];
    for (int i = 1; i < W + H - 1; i++) {
      diagPrefContains[d][i] = add_or({diagPrefContains[d][i - 1], diagContains[d][i]});
    }
    diagSuffContains[d][W + H - 2] = diagContains[d][W + H - 2];
    for (int i = W + H - 3; i >= 0; i--) {
      diagSuffContains[d][i] = add_or({diagContains[d][i], diagSuffContains[d][i + 1]});
    }
    std::vector<int> tmp;
    for (int i = 0; i + K < W + H - 1; i++) {
      tmp.push_back(add_and({diagContains[d][i], diagContains[d][i + K]}));
    }
    diagEqK[d] = add_or(tmp);
    tmp.clear();
    
    tmp.push_back(diagPrefContains[d][W + H - 2 - K]);
    tmp.push_back(diagSuffContains[d][K]);
    for (int i = 1; i + K < W + H - 1; i++) {
      tmp.push_back(add_or({diagPrefContains[d][i - 1], diagSuffContains[d][i + K]}));
    }
    diagLEqK[d] = add_not(add_and(tmp));
    tmp.clear();
  }
  add_or({add_and({diagEqK[0], diagLEqK[1]}),
          add_and({diagEqK[1], diagLEqK[0]})});
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 492 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1900 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -