Cod sursa(job #3378942)

Utilizator TimofeiFilipTimofei Filip Emanuel TimofeiFilip Data 28 noiembrie 2026 21:16:03
Problema Lacate Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.7 kb
#include<fstream>
#include<vector>
using namespace std;

const int NMAX = 256;

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

vector<int> matrix[NMAX + 1];
int main() {
    int n;
    fin >> n;

    int cnt = 1;
    int L = 0;
    for (int i = 1; i <= n - 1; i++) {
        for (int j = i + 1; j <= n; j++) {
            matrix[i].push_back(cnt);
            matrix[j].push_back(cnt);
            cnt++;
            L = max({L, matrix[i][matrix[i].size() - 1], matrix[j][matrix[j].size() - 1]});
        }
    }
    fout << L <<' '<< matrix[1].size() << '\n';
    for (int i = 1; i <= n; i++) {
        for (auto j : matrix[i])
            fout << j << ' ';
        fout << '\n';
    }
    return 0;
}