Pagini recente » Cod sursa (job #790225) | Cod sursa (job #1393426) | Cod sursa (job #1441095) | Cod sursa (job #2588605) | Cod sursa (job #2388884)
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("grozavesti.in");
ofstream fout("grozavesti.out");
int i,j,n,x,v[300],poz,maxim,nr;
vector <pair<int,int> >sol;
int main()
{
fin>>n;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++){
fin>>x;
if(i==j)
v[i]=x;
}
for(i=n;i>1;i--){
maxim=v[i];
for(j=1;j<i;j++)
if(v[j]>maxim){
maxim=v[j];
poz=j;
}
if(maxim==v[i])continue;
sol.push_back(make_pair(i,poz));
swap(v[i],v[poz]);
}
fout<<2*sol.size()<<"\n";
for(i=0;i<sol.size();i++)
fout<<"L "<<sol[i].first<<" "<<sol[i].second<<"\n"<<"C "<<sol[i].first<<" "<<sol[i].second<<"\n";
return 0;
}