|
|
back to boardWhy AC? :) I've solved this problem by using algorithm: my pseudo code: ...... for (i=0; i<S; i++) { for (j=i; j<S and j<i+3; j++) if (sum_from_I_to_J(i,j) > j-i+1 + N) then begin out("NO"); return(0); end; for (j=i+S-10; j<S and j>=i; j++) if (sum_from_I_to_J(i,j) > j-i+1 + N) then begin out("NO"); return(0); end; } out("YES"); .... It was a test solution, I did't thought that I'll got AC. I don't understand, why it works? Thanks. ps sorry for my bad english. |
|
|