|
|
back to boardCommon Board---Problem 1134--- What's wrong with my code. I tried different tests and i don't understand why WA. Var A,B : Array [0..1001] Of Integer; N,K,I : Longint; Fl : Boolean; Begin Read(N);Read(K); If K>N Then Begin Writeln('NO');Halt;End; For I:=1 To K Do Begin Read(A[I]); If A[I]>N Then Begin Writeln('NO');Halt;End; Inc(B[A[I]]); End; If (B[0]=1) And (B[1]=2) Then Begin Writeln('NO');Halt;End; If (B[N-1]=2) And (B[N]=1) Then Begin Writeln('NO');Halt;End; For I:=0 To N Do Begin If B[I]=0 Then Fl:=True; If (B[I]=2) And not Fl Then Begin Writeln('NO');Halt;End; End; For I:=1 To N Do If (B[I-1]=2) And (B[I]=2) Then Begin Writeln('NO');Halt;End; Writeln('YES'); End. |
|
|