分析
直接枚举,得出x,y,z。
结果满足1
const
maxn=250000;
var
a:array[0..maxn]of longint;
n,m,i,j,l,r:longint;
begin
readln(n,m);
for i:=1 to n do
begin
for j:=1 to m do
read(a[j]);
readln;
l:=1; r:=1;
while (a[r]<a[r+1])and(r+1<=m) do inc(r);
if l=r then begin writeln('NIE'); continue; end;
l:=r;
while (a[r]>a[r+1])and(r+1<=m) do inc(r);
if l=r then begin writeln('NIE'); continue; end;
l:=r;
while (a[r]<a[r+1])and(r+1<=m) do inc(r);
if l=r then begin writeln('NIE'); continue; end;
l:=r;
while (a[r]>a[r+1])and(r+1<=m) do inc(r);
if l<r then writeln('TAK')
else writeln('NIE');
end;
end.