#P1401. [入门赛 #18] 禁止在 int 乘 int 时不开 long long

[入门赛 #18] 禁止在 int 乘 int 时不开 long long

Problem Description

In contests, it is very important to analyze the value range of variables clearly according to the Constraints. When an int variable is multiplied by an int variable, it is often possible to exceed the value range that int can represent.

Now, given two int variables x,yx, y and their value ranges, determine whether the value of x×yx \times y may exceed the range that int can represent.

Hint: The range that int can represent is [2147483648,2147483647][-2147483648, 2147483647], i.e. [231,2311][-2^{31}, 2^{31} - 1]. That is, the minimum value representable by int is 2147483648-2147483648, and the maximum value is 21474836472147483647.

Input Format

The input has two lines.

The first line contains two integers xl,xux_l, x_u, indicating that the value range of variable xx is xlxxux_l \le x \le x_u.

The second line contains two integers yl,yuy_l, y_u, indicating that the value range of variable yy is ylyyuy_l \le y \le y_u.

Output Format

Output one line with one string:

  • If it may exceed, output long long int.
  • If it will not exceed, output int.
1 5
1 5
int
-2147483647 2147483647
-2147483647 2147483647
long long int

Hint

Constraints

  • For 50%50\% of the testdata, 0xlxu<2310 \le x_l \le x_u < 2^{31}, 0ylyu<2310 \le y_l \le y_u < 2^{31}.
  • For 100%100\% of the testdata, 231xlxu<231-2^{31} \le x_l \le x_u < 2^{31}, 231ylyu<231-2^{31} \le y_l \le y_u < 2^{31}.

Translated by ChatGPT 5