2017年9月16日普级组 在食人百货绽放的蓝蔷薇

这里写图片描述

分析
直接枚举,得出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.

posted @ 2017-09-22 19:05  银叶草  阅读(129)  评论(0编辑  收藏  举报
Live2D