Files
hanyixuanten bcc4c73f9f
Check cpp / md pair / Check md headers (push) Failing after 0s
new file: P17736.cpp
2026-10-26 10:19:50 +00:00

119 lines
5.4 KiB
C++

#include <bits/stdc++.h>
using namespace std;
const int dat[][3] = {
{1, -1, 0}, {0, 0, 1}, {0, 1, 1}, {1, 1, 1},
{0, 0, 0}, {0, 0, 0}, {-1, -1, 2}, {-1, 0, 2},
{0, 0, 2}, {0, 1, 2}, {1, 1, 2}, {-2, -2, 3},
{-11, 7, 10}, {0, 0, 0}, {0, 0, 0}, {-1, 2, 2},
{0, 2, 2}, {1, 2, 2}, {-2, -1, 3}, {-2, 0, 3},
{-2, 1, 3}, {-14, -11, 16}, {0, 0, 0}, {0, 0, 0},
{2, 2, 2}, {-1, -1, 3}, {-1, 0, 3}, {0, 0, 3},
{0, 1, 3}, {1, 1, 3}, {0, 0, 0}, {0, 0, 0},
{0, 0, 0}, {0, 0, 0}, {-1, 2, 3}, {0, 2, 3},
{1, 2, 3}, {-3, 0, 4}, {-3, 1, 4}, {0, 0, 0},
{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {2, 2, 3},
{-7, -5, 8}, {-3, 2, 4}, {-2, 3, 3}, {-8, 6, 7},
{-2, -2, 4}, {0, 0, 0}, {0, 0, 0}, {-796, 602, 659},
{0, 0, 0}, {-1, 3, 3}, {0, 3, 3}, {1, 3, 3},
{-2, 0, 4}, {-2, 1, 4}, {0, 0, 0}, {0, 0, 0},
{-4, -1, 5}, {-4, 0, 5}, {2, 3, 3}, {-1, 0, 4},
{0, 0, 4}, {0, 1, 4}, {1, 1, 4}, {0, 0, 0},
{0, 0, 0}, {-4, 2, 5}, {-21, 11, 20}, {-1, 2, 4},
{0, 2, 4}, {1, 2, 4}, {0, 0, 0}, {0, 0, 0},
{0, 0, 0}, {0, 0, 0}, {-55, 26, 53}, {-33, -19, 35},
{2, 2, 4}, {3, 3, 3}, {-11, -11, 14}, {-2, 3, 4},
{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {-4126, -1972, 4271},
{-4, 3, 5}, {-7, 6, 6}, {-1, 3, 4}, {0, 3, 4},
{1, 3, 4}, {-5, -5, 7}, {0, 0, 0}, {0, 0, 0},
{-22, 14, 20}, {-3, -1, 5}, {-3, 0, 5}, {2, 3, 4},
{-6, -3, 7}, {-3, 4, 4}, {-239, 118, 229}, {0, 0, 0},
{0, 0, 0}, {-7, -4, 8}, {-3, 2, 5}, {-48, -28, 51},
{-1165, -948, 1345}, {-2, -2, 5}, {0, 0, 0}, {-881, -296, 892},
{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {-10, -6, 11},
{-2, -1, 5}, {-2, 0, 5}, {3, 3, 4}, {-6, -2, 7},
{-2, 4, 4}, {0, 0, 0}, {0, 0, 0}, {-1, -1, 5},
{-1, 0, 5}, {0, 0, 5}, {0, 1, 5}, {1, 1, 5},
{0, 4, 4}, {1, 4, 4}, {0, 0, 0}, {0, 0, 0},
{-1, 2, 5}, {0, 2, 5}, {1, 2, 5}, {-6, 2, 7},
{2, 4, 4}, {-11, -9, 13}, {-86, -77, 103}, {0, 0, 0},
{0, 0, 0}, {2, 2, 5}, {-7, -3, 8}, {0, 0, 0},
{-2, 3, 5}, {-8, -7, 10}, {-9, -5, 10}, {-56, -50, 67},
{0, 0, 0}, {0, 0, 0}, {-367, 260, 317}, {-1, 3, 5},
{0, 3, 5}, {1, 3, 5}, {-5, -4, 7}, {3, 4, 4},
{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {-130, 80, 119},
{2, 3, 5}, {-7, -2, 8}, {-3, 4, 5}, {-26, -21, 30},
{-47, -45, 58}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
{-7, -1, 8}, {-7, 0, 8}, {-7, 1, 8}, {-6, -5, 8},
{0, 0, 0}, {0, 0, 0}, {-8, 7, 7}, {0, 0, 0},
{0, 0, 0}, {-7, 2, 8}, {-13, -10, 15}, {3, 3, 5},
{0, 0, 0}, {-2, 4, 5}, {-14, 9, 13}, {-17, 10, 16},
{0, 0, 0}, {0, 0, 0}, {-4, 5, 5}, {-58, 27, 56},
{-1, 4, 5}, {0, 4, 5}, {1, 4, 5}, {-5, -3, 7},
{4, 4, 4}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
{-7, 3, 8}, {2, 4, 5}, {-48, -19, 49}, {-24, 15, 22},
{-2, -2, 6},
};
int main() {
int t;
scanf("%d", &t);
while (t--) {
int x;
scanf("%d", &x);
int a = dat[x][0], b = dat[x][1], c = dat[x][2];
if (a == 0 && b == 0 && c == 0) {
printf("impossible\n");
} else {
printf("%d %d %d\n", a, b, c);
}
}
return 0;
}
/*
#include <bits/stdc++.h>
using namespace std;
struct ans {
int a, b, c;
bool flag;
} ans[205];
int remain = 201;
long long cube[10005];
int main() {
for (int i = -5000; i <= 5000; i++)
cube[i + 5000] = 1ll * i * i * i;
// a <= b <= c
for (int a = -5000; a <= 4 && remain; a++) {
int bmax = min(5000, (int)cbrt((200 - cube[a + 5000]) / 2.0) + 1);
for (int b = a; b <= bmax && remain; b++) {
// - a^3 - b^3 <= c <= 200 - a^3 - b^3
int cmax = cbrt(200 - cube[a + 5000] - cube[b + 5000]) + 1,
cmin = cbrt(-cube[a + 5000] - cube[b + 5000]) - 1;
int L = max(max(cmin, -5000), b);
int R = min(cmax, 5000);
if (L > R) {
if (b > min(cmax, 5000) || cmax < -5000)
break;
continue;
}
for (int c = max(max(cmin, -5000), b); c <= min(cmax, 5000); c++) {
int now = cube[a + 5000] + cube[b + 5000] + cube[c + 5000];
if (0 <= now && now <= 200) {
if (!ans[now].flag)
ans[now] = {a, b, c, 1}, remain--;
}
}
}
}
int t;
scanf("%d", &t);
while (t--) {
int x;
scanf("%d", &x);
if (ans[x].flag) {
printf("%d %d %d\n", ans[x].a, ans[x].b, ans[x].c);
} else {
printf("impossible\n");
}
}
return 0;
}
*/