search algorithm



  • There's a mass i on j, every element of the mass stores the color of the picel. The picture itself is a preview of other paintings separated by a white strip, and the premiere itself may also contain some sequence of white pickles. пример

    is the task of finding the centers of those superstitions who will tell us how to deal with it?


  • QA Engineer

    Okay, what's wrong with the naive algorithm?

    You're on the X cycle. For each X, check whether the entire column of the X data is made of white cells (name for the white column). Minus the first column can be considered white for simplicity algorithm. If this column is white and the previous one is not, this X is the end of the picture, remember it. If this pole isn't white and the previous one was white, it's the beginning of a new picture, remember it.

    Same for coordinate Y.

    At the beginning and end of the X and Y pictures, the average arithmetics.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2