Pagini recente » Cod sursa (job #2167908) | Cod sursa (job #2851868) | Cod sursa (job #2736578) | Cod sursa (job #1213103) | Cod sursa (job #689444)
Cod sursa(job #689444)
var v,b,c:array[1..10000]of integer;
f,g:text;
i,j,n,m:integer;
begin
assign(f,'cautbin.in');reset(f);
assign(g,'cautbin.out');rewrite(g);
readln(f,n);
for i:=1 to n do
read(f,v[i]);
readln(f,m);
for i:=1 to m do
begin
readln(f,b[i],c[i]);
if b[i]=0 then begin
for j:=n downto 1 do
if c[i]=v[j] then begin writeln(g,j);break;end;
end;
if b[i]=1 then begin
for j:=n downto 1 do
if c[i]>=v[j] then begin writeln(g,j);break;end;end;
if b[i]=2 then begin
for j:=1 to n do
if c[i]=v[j] then begin
writeln(g,j);
break;
end;
end;
end;
close(g);
close(f);
end.