about summary refs log tree commit diff
path: root/others/volume1/061.pas
blob: 46bf839774cddb817b5086de7a7fdf5c4f40100d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var
  n, i: int16;
  a, b: array of int16;

begin
  readln(n);
  setlength(a, n);
  setlength(b, n);
  for i := 0 to n - 1 do
    begin
      read(a[i]);
      b[a[i] - 1] := i + 1
    end;
  for i := 0 to n - 1 do
    if a[i] <> b[i] then
      begin
        writeln('NO');
        exit
      end;
  writeln('YES')
end.