시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 2048 MB111100.000%

문제

Since retiring from a lucrative athletic career, Alex has devoted most of his time to pondering foundational concepts in mathematics. Recently, he has been focusing on the categorization of triangles based on their interior angles, and has invented the acronym AROD to keep track of the four fundamental types:

  • A = acute: all three angles are less than $90$ degrees
  • R = right: one angle is $90$ degrees
  • O = obtuse: one angle is greater than $90$ degrees, but less than $180$ degrees
  • D = degenerate: one angle is $180$ degrees, or, equivalently, the three vertices are collinear

Alex wonders how often three distinct vertices chosen from a regular grid of $x\textrm{-}y$ points specify a triangle in each of the four AROD categories. More precisely, for positive integers $m_x$ and $m_y,$ he wants to consider all possible ways of choosing three distinct vertices from the set \[ V(m_x,m_y) = \{ (x,y) : x \textrm{ and } y \textrm{ are integers, } 0 \leq x \leq m_x, 0 \leq y \leq m_y \} \] and then categorize each of the corresponding triangles into one of the four categories listed above.

입력

The input is a line containing two positive integers, $m_x$ and $m_y,$ satisfying $m_x + m_y \leq 600.$

출력

Output four lines containing the numbers of times three distinct vertices chosen from $V(m_x,m_y)$ specify an acute, right, obtuse, or degenerate triangle, in that order (one number per line).

예제 입력 1

1 2

예제 출력 1

0
14
4
2

예제 입력 2

2 3

예제 출력 2

22
94
84
20

출처

ICPC > Regionals > North America > East Central North America Regional > 2025 East Central NA Regional Contest C번

  • 문제를 만든 사람: Liam Keliher