Блог пользователя Venttix

Автор Venttix, история, 3 часа назад, По-английски

So I did some training and did 389B - Fox and Cross and i did it in a for me decent time as well. like 15 min. The ID is: 393831255 with the basic idea to flat n*n matrix into a 1D array, (because 2D is scary to me idc) and then scan in row-major order to encounter the topmost cell first, then attempt to consume the five cells belonging to a cross, if i dont find the according four other cells ive found an uncommplete cross and cancel. But if i have a cross at [0,n], id have to check [1,n], [2,n], [3,n-1] and [3,n+1]. naturally [2, n+1] doesnt work and id have to return an error here.


4 ...# ..## #..# ....

But due to the flattening of the Matrix to 1D i would simply check [3,0] as id slide into the the next row, as long im not already in the last row(i just checked for < n*n). So my code would accept the exemplary input even tho its pretty clearly not a cross. Now the funny thing is, my approach is so stupid that the Judge never checks such edge case and still let my code pass haha

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
2 часа назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Venttix (previous revision, new revision, compare).