Cod sursa(job #3162503)

Utilizator Alexbora13Bora Ioan Alexandru Alexbora13 Data 29 octombrie 2023 12:44:08
Problema Grozavesti Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.76 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("grozavesti.in");
ofstream fout("grozavesti.out");

struct str{
    int val;
    int ind;
};

int fun(str A, str B)
{
    if(A.val < B.val)
    {
        fout << "L " << A.ind << ' ' << A.ind-1 << '\n';
        fout << "C " << A.ind << ' ' << A.ind-1 << '\n';
        return 1;
    }
    return 0;
}

int n, x, r;
str col[301];

int main()
{
    ios::sync_with_stdio(false);
    fin.tie(NULL);
    fout.tie(NULL);
    fin >> n;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=n; j++)
        {
            fin >> x;
            if(i==j)
                col[r++]={x, i};
        }
    }
    sort(col,col+r,fun);
    fin.close();
    fout.close();
    return 0;
}