Pagini recente » Cod sursa (job #400850) | Cod sursa (job #689479) | Cod sursa (job #260959) | Cod sursa (job #468729) | Cod sursa (job #137017)
Cod sursa(job #137017)
Const fin ='grozavesti.in';
fout='grozavesti.out';
nmax=300;
Type cel=Record
L1,C1,L2,C2:integer;
End;
Var
f:text;
A:Array[1..nmax,1..nmax] of LongInt;
p,i,j,n,k:integer;
x,min:longint;
B:array[1..nmax] of cel;
Begin
assign(f,fin); reset(f);
readln(f,n);
For i:=1 to n do
For j:=1 to n Do
Read(f,a[i,j]);
close(f);
k:=0;
for i:=1 to n-1 do
begin
p:=i;
for j:=i+1 to n do
if a[j,j]<a[p,p] then p:=j;
if p<>i then begin
x:=a[i,i];
a[i,i]:=a[p,p];
a[p,p]:=x;
k:=k+1;
B[k].L1:=i;
B[k].L2:=p;
B[k].C1:=i;
B[k].C2:=p;
end;
end;
assign(f,fout);rewrite(f);
Writeln(f,2*k);
For i:=1 to k do
begin
Writeln(f,'C ',B[i].C1,' ',B[i].C2);
Writeln(f,'L ',B[i].L1,' ',B[i].L2);
end;
close(f);
End.