/* -*- coding: utf-8 -*- * * 3506.cc: No.3506 All Distance is Square Number - yukicoder */ #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100; const int MAX_M = MAX_N * 2 - 3; /* typedef */ using vi = vector; using tp3 = tuple; /* global variables */ tp3 es[MAX_M]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); int m = 0; for (int i = 0; i + 1 < n; i++) es[m++] = {i, i + 1, 2 * i + 1}; for (int i = 2; i < n; i++) es[m++] = {1, i, 2 * i}; printf("%d\n", m); for (int i = 0; i < m; i++) { auto [u, v, w] = es[i]; printf("%d %d %d\n", u + 1, v + 1, w); } for (int x = 0; x < n; x++) for (int y = x + 1; y < n; y++) { vi q; int u = x; int sum = 0; if (u != 0) { while (u > 1) { q.push_back(u - 1); sum += get<2>(es[u - 1]); u--; } u = x + 1; q.push_back((n - 1) + u - 2); sum += get<2>(es[(n - 1) + u - 2]); } while (u < y) { q.push_back(u); sum += get<2>(es[u]); u++; } //printf(" sum=%d, y=%d\n", sum, y); //assert(sum == y * y); printf("%d", (int)q.size()); for (auto u: q) printf(" %d", u + 1); putchar('\n'); } return 0; }