Cod sursa(job #2655771)

Utilizator Dragono63Stanciu Rares Stefan Dragono63 Data 5 octombrie 2020 15:28:49
Problema Lacate Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 1.25 kb
#include <bits/stdc++.h>
#define NMAX 270
using namespace std;

/******************************************************/
/// INPUT / OUTPUT
ifstream f("lacate.in");
ofstream g("lacate.out");
/******************************************************/
/// GLOBAL DECLARATIONS

int n, keyIndex;

vector < int > keys[NMAX];

/******************************************************/
///------------------------------------------------------------------
inline void readInput()
{
    f >> n;
}
///------------------------------------------------------------------
inline void Solution()
{
    for(int i = 1; i < n ; ++ i)
    {
        for(int j = i + 1 ; j <= n ; ++j)
        {
            keyIndex ++;
            keys[i].push_back(keyIndex);
            keys[j].push_back(keyIndex);
        }
    }
}
///------------------------------------------------------------------
inline void Output()
{
    g << keyIndex << " " << n - 1 << "\n";

    for(int i = 1; i <= n ; ++i)
    {
        for(auto it : keys[i])
        {
            g << it << " ";
        }
        g << "\n";
    }
}
///------------------------------------------------------------------
int main()
{
    readInput();
    Solution();
    Output();
    return 0;
}