CF311A.The Closest Pair

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.

The problem is the follows. Given nn points in the plane, find a pair of points between which the distance is minimized. Distance between (x1,y1)(x_{1},y_{1}) and (x2,y2)(x_{2},y_{2}) is .

The pseudo code of the unexpected code is as follows:

<br></br>input n<br></br>for i from 1 to n<br></br> input the i-th point's coordinates into p[i]<br></br>sort array p[] by increasing of x coordinate first and increasing of y coordinate second<br></br>d=INF //here INF is a number big enough<br></br>tot=0<br></br>for i from 1 to n<br></br> for j from (i+1) to n<br></br> ++tot<br></br> if (p[j].x-p[i].x>=d) then break //notice that "break" is only to be<br></br> //out of the loop "for j"<br></br> d=min(d,distance(p[i],p[j]))<br></br>output d<br></br>Here, tottot can be regarded as the running time of the code. Due to the fact that a computer can only run a limited number of operations per second, tottot should not be more than kk in order not to get Time Limit Exceeded.

You are a great hacker. Would you please help Tiny generate a test data and let the code get Time Limit Exceeded?

输入格式

A single line which contains two space-separated integers nn and kk ( 2<=n<=20002<=n<=2000 , 1<=k<=1091<=k<=10^{9} ).

输出格式

If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print nn lines, and the ii -th line contains two integers xi,yix_{i},y_{i} (xi,yi<=109)(|x_{i}|,|y_{i}|<=10^{9}) representing the coordinates of the ii -th point.

The conditions below must be held:

  • All the points must be distinct.
  • xi,yi<=109|x_{i}|,|y_{i}|<=10^{9} .
  • After running the given code, the value of tottot should be larger than kk .

输入输出样例

  • 输入#1

    4 3
    

    输出#1

    0 0
    0 1
    1 0
    1 1
    
  • 输入#2

    2 100
    

    输出#2

    no solution
    
首页