F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Maximum Triangles

Time Limit: 10000/10000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 33    Accepted Submission(s): 9
Special Judge


Problem Description
We called a triangle is good if and only If the triangle contains the origin.

You need to find $n$ points on the plane, satisfying:

- None any two of them and the origin should be collinear.
- The coordinates of each point should be an integer and in the range $[-50000,50000]$.
- Under the above limits, the number of good triangles made up of those $n$ points should be maximized.

Output the maximum number and a set of the coordinates of those $n$ points for which the maximum is reached.
 

Input
The first line of input contains a single integer $T(1\leq T\leq 10)$, indicating the number of test cases.

Each of the next $T$ lines contains a single integer $n(1\leq n\leq 2\times 10^5)$, describing the number of points you have to find for that test case.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$.
 

Output
For each test case print $(n+1)$ lines. The first line should contain a single integer, denoting the maximum number of good triangles. The $i$-th of the next $n$ lines should contain two space-separated integers $x_i,y_i(|x_i|,|y_i|\leq 50000)$, denoting the coordinates of the $i$-th point of the set. If there are multiple solutions, output any.

 

Sample Input
1 3
 

Sample Output
1 0 1 -1 -1 1 -1
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 11:19:11, Gzip enabled