Pagini recente » Cod sursa (job #1986306) | Cod sursa (job #1355548) | Cod sursa (job #1463643) | Cod sursa (job #843306) | Cod sursa (job #2350772)
#include<fstream>
using namespace std;
ifstream fin("grozavesti.in");
ofstream fout("grozavesti.out");
struct el{int x,y;}C[310];
int n,i,t,T,ma,j,po,m[310][310];
int main()
{
fin >> n;
for(i=1;i<=n;++i)
for(j=1;j<=n;++j) fin >> m[i][j];
for(t=0;t<n;++t)
{
ma=0;
for(i=1;i<=n-t;++i)
if(m[i][i]>ma) po=i,ma=m[i][i];
if(po!=n-t)
{
C[++T]={po,n-t};
swap(m[po][po],m[n-t][n-t]);
}
}
fout << 2*T <<'\n';
for(i=1;i<=T;++i)
fout << "C "<< C[i].x <<' '<< C[i].y << '\n' << "L "<< C[i].x <<' '<<C[i].y<<'\n';
return 0;
}