Pagini recente » Cod sursa (job #3272917) | Cod sursa (job #1711201) | Cod sursa (job #2684962) | Cod sursa (job #1706282) | Cod sursa (job #115113)
Cod sursa(job #115113)
var n,i,j,nr,t,aux:longint;
v:array[1..310,1..310]of longint;
p,x:array[1..310] of longint;
begin
assign(input,'grozavesti.in');reset(input);
assign(output,'grozavesti.out');rewrite(output);
readln(n);
for i:=1 to n do
for j:=1 to n do
read(v[i,j]);
for i:=1 to n do
begin
nr:=0;
for j:=1 to n do
if (v[j,j]<v[i,i])or ((v[j,j]=v[i,i])and(i<=j)) then
inc(nr);
p[nr]:=i;
end;
//p[i]=indicele numarului care trebuie sa ajunga pe pozitia i
x:=p;
for i:=1 to n do
if i<>p[i] then
begin
for j:=1 to n do
if p[j]=i then
break;
aux:=p[i];
p[i]:=p[j];
p[j]:=aux;
inc(t);
end;
p:=x;
writeln(2*t);
for i:=1 to n do
begin
if i<>p[i] then
begin
writeln('L ',i,' ',p[i]);
writeln('C ',i,' ',p[i]);
for j:=1 to n do
if p[j]=i then
break;
aux:=p[i];
p[i]:=p[j];
p[j]:=aux;
end;
end;
close(input);close(output);
end.