2045. 在食人百货绽放的蓝蔷薇

来源:互联网 发布:mysql远程管理工具 编辑:程序博客网 时间:2024/05/16 01:49

2045. 在食人百货绽放的蓝蔷薇 


输入

第一行两个整数 T,n,T 表示数据的组数。
接下来 T 行,每行 n 个整数,第 i 个整数表示 Hi。

输出

对于每朵蓝蔷薇,若为真品输出TAK,否则输出 NIE。

样例输入

2 11
1 2 3 4 3 2 3 4 3 2 1
9 8 7 6 7 8 9 10 9 8 7

样例输出

TAK
NIE

数据范围限制

20%的数据保证,n≤50。
40%的数据保证,n≤200。
60%的数据保证,n≤1000。
80%的数据保证,n≤10^5。
100%的数据保证,T≤10,n≤2.5×10^5,1≤Hi≤10^9。

 

 

就是按他的要求枚举就好了。。。

 

const  maxn=250000;var  a:array[0..maxn]of longint; n,m,i,j,p,q:longint;begin assign(input,'rose.in');reset(input); assign(output,'rose.out');rewrite(output); readln(n,m);  for i:=1 ton do    begin      for j:=1to m do        read(a[j]);      readln;      p:=1;      whilea[p]<a[p+1] do inc(p);      if p=m thenbegin writeln('NIE');continue;end;      whilea[p]>a[p+1] do inc(p);      if p=m thenbegin writeln('NIE');continue;end;      whilea[p]<a[p+1] do inc(p);      if p=m thenbegin writeln('NIE');continue;end;      while(a[p]>a[p+1]) and (p+1<=m) do inc(p);       if p=m        thenwriteln('TAK')        elsewriteln('NIE');    end; close(input);close(output);end.

0 0
原创粉丝点击