#P16360. [BalticOI 2026] Distances

    ID: 16382 Type: RemoteJudge 1000ms 512MiB Tried: 0 Accepted: 0 Difficulty: 7 Uploaded By: Tags>Special JudgeBalticOI(波罗的海)2026

[BalticOI 2026] Distances

题目描述

You are given integers nn and kk. Your goal is to pick nn distinct integer points on the xyxy-plane such that for exactly kk pairs of points, the Euclidean distance between the points is an integer. Recall that the Euclidean distance between points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) is

(x1x2)2+(y1y2)2.\sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}.

It can be shown that a solution always exists under the constraints of this task.

输入格式

The only line contains two integers, nn and kk.

输出格式

Print nn lines with the iith line containing two integers: the xx and yy coordinates of the iith point. The absolute value of every coordinate must be at most 10910^9.

If there are multiple solutions, you can print any of them.

3 2
1 1
1 2
2 2

提示

Explanation

The Euclidean distance between (1,1)(1, 1) and (1,2)(1, 2) is 11. The distance between (1,2)(1, 2) and (2,2)(2, 2) is also 11. However, the distance between (1,1)(1, 1) and (2,2)(2, 2) is 2\sqrt 2, which is not an integer.

Constraints

  • 1n1001 \le n \le 100
  • 0kn(n1)/20 \le k \le n(n - 1) / 2

Scoring

Subtask Constraints Points
1 n4n \le 4 1111
2 k=n(n1)/2k = n(n-1)/2 44
3 k=0k = 0 66
4 knk \le n 1919
5 kn(n1)/8k \le n(n-1) / 8 2222
6 No additional constraints 3838