#include // int tmp, var = 0, sign = 0; を先に宣言する #define rd_int(var, tmp, sign) \ for (;;) { \ tmp = getchar_unlocked(); \ if (tmp == '-') { \ sign = 1; \ break; \ } else if ('0' <= tmp && tmp <= '9') { \ var = tmp - '0'; \ break; \ } \ } \ for (;;) { \ tmp = getc_unlocked(stdin); \ if (tmp < '0' || tmp > '9') break; \ var = var * 10 + tmp - '0'; \ } \ if (sign) var = -var; // char buf[9]; int ptr = 0, sign = 0; を先に宣言する #define wt_int(var, buf, ptr, sign) \ if (var < 0) { \ sign = 1; \ var = -var; \ } \ while (var) { \ buf[ptr++] = var % 10; \ var /= 10; \ } \ if (!ptr) buf[ptr++] = 0; \ if (sign) putc_unlocked('-', stdout); \ while (ptr--) putc_unlocked(buf[ptr] + '0', stdout); #define rd_int_(var, tmp, sign) \ var = sign = 0; \ rd_int(var, tmp, sign); #define wt_int_(var, buf, ptr, sign) \ ptr = sign = 0; \ wt_int(var, buf, ptr, sign); #define f(x, a, b, c, d) (a * x * x * x + b * x * x + c * x + d) int main() { int a, b, c, d, p, q, tmp, sign, ptr; char buf[10]; rd_int_(a, tmp, sign); rd_int_(b, tmp, sign); rd_int_(c, tmp, sign); rd_int_(d, tmp, sign); rd_int_(p, tmp, sign); rd_int_(q, tmp, sign); int y = f(p, a, b, c, d); int mi = y, ma = y, xmi = p, xma = p; for (int x = p + 1; x <= q; ++x) { y = f(x, a, b, c, d); if (y < mi) mi = y, xmi = x; if (y > ma) ma = y, xma = x; } wt_int_(ma, buf, ptr, sign); putc_unlocked(' ', stdout); wt_int_(xma, buf, ptr, sign); putc_unlocked(' ', stdout); wt_int_(mi, buf, ptr, sign); putc_unlocked(' ', stdout); wt_int_(xmi, buf, ptr, sign); return 0; }