Pagini recente » Cod sursa (job #789227) | Cod sursa (job #13978) | Cod sursa (job #48537) | Cod sursa (job #3241581) | Cod sursa (job #116346)
Cod sursa(job #116346)
program Grozavesti{ pre ONI runda2 2007};
Var f,g,h :text;
n,m,i,j,x,y,min,poz:integer;
c:char;
a,b:array[1..300] of integer;
begin
assign(f,'grozavesti.in');reset(f);
assign(g,'grozavesti.out');rewrite(g);
readln(f,n);
for i:=1 to n do
begin
for j:=1 to n do
begin
read(f,x);
if i=j then a[i]:=x;
end;
readln(f);
end;
assign(h,'auxiliar');rewrite(h);
for i:=1 to n do
begin
min:=a[i];poz:=i;
for j:=i+1 to n do
if a[j]<min then begin min:=a[j];poz:=j;end;
if poz<>i then begin
x:=a[i];
a[i]:=a[poz];
a[poz]:=x;
m:=m+2; writeln(h,'C ',i,' ',poz);writeln(h,'L ',i,' ',poz);end;
end;
close(h);
reset(h);
writeln(g,m);
for i:=1 to m do
begin
readln(h,c,x,y);
writeln(g,c,' ',x,' ',y);
end;
close(g);
close(f);
close(h);
end.