const fi=’daytangdan.inp’; fo=’daytangdan.out’; type mang = array [1..100000] of longint; var a:mang; i,j,n:longint; function check(a: mang):boolean; begin for i:=1 to n-1 do for j:=i+1 to n do if a[i]>a[j] then exit(false); exit(true); end; begin assign(input,fi); reset(input); readln(n); for i:=1 to n do read(a[i]); close(input); assign(output,fo); rewrite(output); if check(a) then write(‘YES’) else write(‘NO’); close(output); end.
Uses crt;
var f,g:text;
n,i:longInt;
a:array[1..1000000] of integer;
Kt:boolean;
begin
assign(f,’nhap.inp’);reset(f);
readln(f,n);
for i:=1 to n do read(f,a[i]);
close(f);
assign(g,’xuat.out’);rewrite(g);
kt:=true;
for i:=1 to n-1 do if a[i]>a[i+1] then
Begin
kt:=false;
Write(g,’la day tang’);
Break;
End;
if kt:=true then write(g,’ko phai day tang’);
close(g);
end.
const fi=’daytangdan.inp’;
fo=’daytangdan.out’;
type mang = array [1..100000] of longint;
var a:mang;
i,j,n:longint;
function check(a: mang):boolean;
begin
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
exit(false);
exit(true);
end;
begin
assign(input,fi);
reset(input);
readln(n);
for i:=1 to n do read(a[i]);
close(input);
assign(output,fo);
rewrite(output);
if check(a) then write(‘YES’) else write(‘NO’);
close(output);
end.