about summary refs log tree commit diff
path: root/others/volume1/020.pas
blob: f37db27bc2da5e3570a6a195f0bb95750ff044c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var
  n, max, l, h, l0, h0: smallint;
  a: array of int64;

begin
  readln(n);
  setlength(a, n + 1);
  for l := 0 to n - 1 do
    read(a[l]);
  a[n] := 0;
  max := 0;
  l0 := 0;
  h0 := 0;
  l := 0;
  while l < n do
    for h := l to n - 1 do
      if a[h] * a[h + 1] >= 0 then
        begin
          if max < h - l then
            begin
              max := h - l;
              l0 := l;
              h0 := h
            end;
          l := h + 1;
          break
        end;

  writeln(l0 + 1, ' ', h0 + 1)
end.