/* -*- coding: utf-8 -*- * * 1837.cc: No.1837 Same but Different - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 3000; const int MAX_A = 10000; /* typedef */ /* global variables */ int as[MAX_N], bs[MAX_N]; bool used[MAX_A * 2 + 1]; /* subroutines */ void printv(int n, int v[]) { for (int i = 0; i < n; i++) printf("%d%c", v[i], (i + 1 < n) ? ' ' : '\n'); } bool check(int n) { fill(used, used + MAX_A * 2 + 1, false); for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) used[as[i] + as[j]] = true; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) if (used[bs[i] + bs[j]]) { printf(" check NG: sum=%d\n", bs[i] + bs[j]); return false; } return true; } /* main */ int main() { int n; scanf("%d", &n); int asum = 0, bsum = 0; for (int i = 0; i < n; i++) as[i] = i * 3, asum += as[i]; for (int i = 0; i < n; i++) bs[i] = i * 3 + 7, bsum += bs[i]; int r = n % 3; if (r == 1) as[0]++, asum++; else if (r == 2) as[0]++, as[1]++, asum += 2; for (int i = n - 1; bsum > asum;) { as[i] += 3, asum += 3; if (--i < 2) i = n - 1; } printv(n, as), printv(n, bs); //if (check(n)) puts("OK"); //else puts("NG"); return 0; }