E - Manhattan Multifocal Ellipse
Editorial
/


Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
次元平面上の 個の点 と、非負整数 が与えられます。
整数の組 であって、 を満たすものの個数を求めてください。
制約
- ならば
- 入力はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
出力
答えを出力せよ。
入力例 1Copy
Copy
2 3 0 0 1 0
出力例 1Copy
Copy
8
下図は、サンプル の入力と答えを可視化したものです。青い点が入力を表します。青い点と赤い点の合計 点が、問題文中の条件を満たす点です。
入力例 2Copy
Copy
2 0 0 0 2 0
出力例 2Copy
Copy
0
入力例 3Copy
Copy
6 100 9 -6 10 -1 2 10 -1 7 -7 5 -1 -4
出力例 3Copy
Copy
419
Score : points
Problem Statement
You are given points on a two-dimensional plane, and a non-negative integer .
Find the number of integer pairs such that .
Constraints
- for .
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1Copy
Copy
2 3 0 0 1 0
Sample Output 1Copy
Copy
8
The following figure visualizes the input and the answer for Sample . The blue points represent the input. The blue and red points, eight in total, satisfy the condition in the statement.
Sample Input 2Copy
Copy
2 0 0 0 2 0
Sample Output 2Copy
Copy
0
Sample Input 3Copy
Copy
6 100 9 -6 10 -1 2 10 -1 7 -7 5 -1 -4
Sample Output 3Copy
Copy
419